+
    ^Hj:                    D   R t ^ RIHt ^ RIt^ RIHt ^ RIHt ^ RIt]! ]	4      P                  4       P                  P                  t]! ]4      ]P                  9  d#   ]P                  P                  ^ ]! ]4      4       ^ RIHtHtHt ]R,          tRt ! R R	]4      tR# )
uS  ListGlobally search source — meta-aggregator backing Properstar.

Endpoint discovered 2026-05-25 via probing: POST /api/v1/listings/search
returns 401 (not 404/405), meaning the endpoint EXISTS and accepts our body
but requires JWT auth. Same token as sources/properstar.py (.properstar_token).

STATUS: scaffolded but body schema unknown. Token currently 84d expired,
so live exploration is blocked on `python3 import_favorites.py --login` to
refresh credentials.

POST-REFRESH workflow:
1. Refresh token: `python3 import_favorites.py --login` (browser)
2. Try body shapes against /api/v1/listings/search (try {country, region,
   minPrice, maxPrice, page, pageSize} first — common REST convention)
3. Inspect response shape, map fields → PropertyHit
4. Populate _real_search() below

WHY THIS MATTERS:
- Same auth as Properstar (we already have the JWT flow)
- Bypasses per-platform bot blocks (Idealista/Immobiliare are aggregated here)
- Adds Spain/Portugal/Netherlands inventory without writing per-country scrapers
- Filters (price, size, bedrooms) likely pushable into the API payload upstream
)annotationsN)Path)Iterator)PropertyHitSearchCriteriaSourcez.properstar_tokenz<https://listings-api.listglobally.com/api/v1/listings/searchc                  N    ] tR t^*tRt. ROtRtR R ltR R ltRR R	 llt	R
t
R# )ListGloballySearchSourcelistglobally_searchTc                   V ^8  d   QhRR/# )   returnz
str | None )formats   "c/Users/jonathan/Documents/Zakelijk/ClaudeOS/03_Lab/farmmatch/scraper/sources/listglobally_search.py__annotate__%ListGloballySearchSource.__annotate__/   s     2 2J 2    c                	    \         P                  4       '       g   R # \         P                  4       P                  4       pVP	                  R4      '       d   V# R # )NeyJ)
TOKEN_PATHexists	read_textstrip
startswith)selfts   & r   
_get_token#ListGloballySearchSource._get_token/   sD      ""  "((*LL''q1T1r   c                   V ^8  d   QhRR/# )r   r   ztuple[bool, str]r   )r   s   "r   r   r   5   s     0 0( 0r   c                	   V P                  4       pV'       g   R#  \        P                  ! \        RRV 2RRRRRRRR	/R
RR^R^/^
R7      pVP                  R8X  d   R# VP                  ^8X  d   R# VP                  R8X  d   RRVP
                  R,           23# R RVP                   23#   \        P                   d#   pR \        T4      P                   3u Rp?# Rp?ii ; i)FAuthorizationzBearer Acceptzapplication/jsonzContent-Typez
User-Agentzfarmmatch/1.0Refererzhttps://www.properstar.nl/countryFRpagepageSize)headersjsontimeouti  Ti  z"auth OK, body shape needs tuning: :NP   NzHTTP N)Fz3no token (run: python3 import_favorites.py --login))Fztoken expired (run --login))Tauthenticated)	r   requestspost
SEARCH_URLstatus_codetextRequestExceptiontype__name__)r   tokenres   &   r   healthListGloballySearchSource.health5   s    !OO	0(GE7*;!#5');%"$@	B
  vq*a@	A }}#;;}}#,,}}#A!&&+OOOE!--111(( 	0T!W--.//	0s0   AB-  B- 3(B- B- -C$CC$C$Nc               $    V ^8  d   QhRRRRRR/# )r   criteriar   
known_urlszset[str] | Noner   zIterator[PropertyHit]r   )r   s   "r   r   r   Q   s#      ~ *6Kr   c              #  B   "   V P                  4       pV'       g   R# R# 5i)u   STUB — needs body schema discovery post-token-refresh.

Once schema is known, implement: build body from criteria, POST,
iterate response['listings'] (or similar), yield PropertyHit per item.
Use criteria.max_pages to paginate.
N)r   )r   r;   r<   r5   s   &&& r   searchListGloballySearchSource.searchQ   s      ! 	s   r   )r%   ITESPTNLBEDE)N)r4   
__module____qualname____firstlineno__name	countriesrequires_authr   r8   r>   __static_attributes__r   r   r   r	   r	   *   s%     D:IM208 r   r	   )__doc__
__future__r   syspathlibr   typingr   r-   __file__resolveparent
SCRIPT_DIRstrpathinsertsources._baser   r   r   r   r/   r	   r   r   r   <module>rZ      s   . # 
   (^##%,,33
z?#(("HHOOAs:' = =--
K
:v :r   