convert district at the last moment - when we send the query

This commit is contained in:
Viktor Barzin 2025-06-22 13:05:53 +00:00
parent bcece4500a
commit bf79d3c977
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863

View file

@ -5,6 +5,7 @@ import enum
from typing import Any from typing import Any
import aiohttp import aiohttp
from models.listing import FurnishType, ListingType, QueryParameters from models.listing import FurnishType, ListingType, QueryParameters
from rec import districts
from tenacity import retry, wait_random from tenacity import retry, wait_random
@ -52,7 +53,7 @@ async def listing_query(
radius: float, radius: float,
min_price: int, min_price: int,
max_price: int, max_price: int,
location_id: str, # = "STATION^5168", # kings cross station district: str, # = "STATION^5168", # kings cross station
mustNewHome: bool = False, mustNewHome: bool = False,
max_days_since_added: int = 30, max_days_since_added: int = 30,
property_type: list[PropertyType] = [], property_type: list[PropertyType] = [],
@ -60,7 +61,7 @@ async def listing_query(
furnish_types: list[FurnishType] = [], furnish_types: list[FurnishType] = [],
) -> dict[str, Any]: ) -> dict[str, Any]:
params: dict[str, str] = { params: dict[str, str] = {
"locationIdentifier": location_id, "locationIdentifier": districts.get_districts()[district],
"channel": str(channel).upper(), "channel": str(channel).upper(),
"page": str(page), "page": str(page),
"numberOfPropertiesPerPage": str(page_size), "numberOfPropertiesPerPage": str(page_size),