5

Im trying to use geopy to get the lat/long but it throws a http 403 forbidden error.

from geopy.geocoders import Nominatim
geolocator = Nominatim()
addr = '350 5th Ave, New York, NY 10118'
location = geolocator.geocode(addr)
print location

It was all working fine for last few days.

    raise ERROR_CODE_MAP[code](message)
geopy.exc.GeocoderInsufficientPrivileges: HTTP Error 403: Forbidden
user1050619
  • 19,822
  • 85
  • 237
  • 413

2 Answers2

4

I probably fixed the problem. According to this documentation https://geopy.readthedocs.io/en/stable/#nominatim you need to specify user-agent for each app that is using Nominatim

        geolocator = Nominatim(user_agent="name_of_your_app")
premma
  • 323
  • 1
  • 2
  • 9
4

"GeocoderInsufficientPrivileges" error - try to use 'Photon' instead of 'Nominatim'

from geopy.geocoders import Photon
geolocator = Photon(user_agent="measurements")
Developer-Felix
  • 337
  • 2
  • 4