1

When I try to run this code.

from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="ryan_data")
location = geolocator.geocode("175 5th Avenue NYC")
print(location.address)

I get this error.

GeocoderUnavailable: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /search?q=175+5th+Avenue+NYC&format=json&limit=1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))

This should be a pretty simple thing, but I can't get the code to run. I'm trying to run the code on my corporate laptop. The exact same code works perfectly find on my personal laptop. Any idea what's wrong here?

Documentation is here.

https://geopy.readthedocs.io/en/stable/#module-geopy.geocoders

ASH
  • 20,759
  • 19
  • 87
  • 200
  • your company is probably doing "SSL inspection" and your local installation of python does not "trust" che CA that the company uses. Either you disable SSL verification completely or you find the way to add the CA do the trusted CA certificates. See https://geopy.readthedocs.io/en/stable/#module-geopy.geocoders "default_ssl_context" – Danilo Apr 07 '23 at 09:48
  • I copied a .py file from my personal laptop to my work laptop, and then everything worked fine. Thanks. – ASH Apr 07 '23 at 13:34

0 Answers0