Skip to content

Commit

Permalink
Include lang in url args to prevent cache errors
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Apr 30, 2024
1 parent e333186 commit a8b0c8a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions neon_api_proxy/services/map_maker_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def handle_query(self, **kwargs) -> dict:
:param kwargs:
'lat' - optional str latitude
'lon' - optional str longitude
'lang_code' - optional language code to request results in
'address' - optional string address/place to resolve
:return: dict containing `status_code`, `content`, `encoding`
from URL response
Expand Down Expand Up @@ -99,13 +100,15 @@ def handle_query(self, **kwargs) -> dict:
def _query_geocode(self, address: str, lang: str) -> Response:
self.session.headers['Accept-Language'] = lang
query_str = urllib.parse.urlencode({"q": address,
"api_key": self._api_key})
"api_key": self._api_key,
"lang": lang})
request_url = f"{self.geocode_url}?{query_str}"
return self.get_with_cache_timeout(request_url, self.cache_timeout)

def _query_reverse(self, lat: float, lon: float, lang: str):
self.session.headers['Accept-Language'] = lang
query_str = urllib.parse.urlencode({"lat": lat, "lon": lon,
"api_key": self._api_key})
"api_key": self._api_key,
"lang": lang})
request_url = f"{self.reverse_url}?{query_str}"
return self.get_with_cache_timeout(request_url, self.cache_timeout)

0 comments on commit a8b0c8a

Please sign in to comment.