Skip to content

Commit

Permalink
Troubleshooting result languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel McKnight committed Apr 30, 2024
1 parent 76d79a2 commit ddcc03c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions neon_api_proxy/services/map_maker_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ def handle_query(self, **kwargs) -> dict:
"encoding": response.encoding}

def _query_geocode(self, address: str, lang: str) -> Response:
self.session.headers['Accept-Language'] = lang
self.session.headers['Content-Language'] = lang
query_str = urllib.parse.urlencode({"q": address,
"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
self.session.headers['Content-Language'] = lang
query_str = urllib.parse.urlencode({"lat": lat, "lon": lon,
"api_key": self._api_key,
"lang": lang})
Expand Down
4 changes: 2 additions & 2 deletions tests/test_map_maker_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def test_geocode_lookup(self):
self.assertEqual(valid_es_location["encoding"].lower(), "utf-8")
es_location = json.loads(valid_es_location["content"])[0]
self.assertNotEqual(valid_location, es_location)
self.assertEqual(valid_location['lat'], es_location['lat'])
self.assertEqual(valid_location['lon'], es_location['lon'])
self.assertEqual(valid_location['lat'], es_location['lat'], es_location)
self.assertEqual(valid_location['lon'], es_location['lon'], es_location)

invalid_response = self.api.handle_query(address=INVALID_ADDRESS)
self.assertEqual(invalid_response['status_code'], -1)
Expand Down

0 comments on commit ddcc03c

Please sign in to comment.