Dec-04-2020, 04:15 PM
Hey guys,
Hoping someone can explain the issue I'm having with Geolocator...it was working fine yesterday, but now when I run the cell it is coming back with Gateway 502 error. Attached below is the code and error message.
Thank you.
Hoping someone can explain the issue I'm having with Geolocator...it was working fine yesterday, but now when I run the cell it is coming back with Gateway 502 error. Attached below is the code and error message.
1 2 3 4 5 6 7 |
address = 'Chicago, IL, USA' geolocator = Nominatim(user_agent = "class-app" ) location = geolocator.geocode(address) latitude = location.latitude longitude = location.longitude print ( 'The geographical coordinate of Chicago are {}, {}.' . format (latitude, longitude)) |
Error:AdapterHTTPError Traceback (most recent call last)
/opt/conda/envs/Python-3.7-main/lib/python3.7/site-packages/geopy/geocoders/base.py in _call_geocoder(self, url, callback, timeout, is_json, headers)
359 if is_json:
--> 360 result = self.adapter.get_json(url, timeout=timeout, headers=req_headers)
361 else:
/opt/conda/envs/Python-3.7-main/lib/python3.7/site-packages/geopy/adapters.py in get_json(self, url, timeout, headers)
372 def get_json(self, url, *, timeout, headers):
--> 373 resp = self._request(url, timeout=timeout, headers=headers)
374 try:
/opt/conda/envs/Python-3.7-main/lib/python3.7/site-packages/geopy/adapters.py in _request(self, url, timeout, headers)
403 status_code=resp.status_code,
--> 404 text=resp.text,
405 )
AdapterHTTPError: Non-successful status code 502
The above exception was the direct cause of the following exception:
GeocoderServiceError Traceback (most recent call last)
<ipython-input-52-b44a620f75c6> in <module>
2
3 geolocator = Nominatim(user_agent="class-app")
----> 4 location = geolocator.geocode(address)
5 latitude = location.latitude
6 longitude = location.longitude
/opt/conda/envs/Python-3.7-main/lib/python3.7/site-packages/geopy/geocoders/nominatim.py in geocode(self, query, exactly_one, timeout, limit, addressdetails, language, geometry, extratags, country_codes, viewbox, bounded, featuretype, namedetails)
292 logger.debug("%s.geocode: %s", self.__class__.__name__, url)
293 callback = partial(self._parse_json, exactly_one=exactly_one)
--> 294 return self._call_geocoder(url, callback, timeout=timeout)
295
296 def reverse(
/opt/conda/envs/Python-3.7-main/lib/python3.7/site-packages/geopy/geocoders/base.py in _call_geocoder(self, url, callback, timeout, is_json, headers)
376 return callback(result)
377 except Exception as error:
--> 378 self._adapter_error_handler(error)
379 raise
380
/opt/conda/envs/Python-3.7-main/lib/python3.7/site-packages/geopy/geocoders/base.py in _adapter_error_handler(self, error)
390 self._geocoder_exception_handler(error)
391 exc_cls = ERROR_CODE_MAP.get(error.status_code, GeocoderServiceError)
--> 392 raise exc_cls(str(error)) from error
393 else:
394 self._geocoder_exception_handler(error)
GeocoderServiceError: Non-successful status code 502
Please advise what I am doing wrong. Thank you.