首页 > 解决方案 > geopy.exc.GeocoderInsufficientPrivileges:HTTP 错误 403:禁止

问题描述

我试图使用 geopy 来获取纬度/经度,但它会引发 http 403 禁止错误。

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

过去几天一切正常。

    raise ERROR_CODE_MAP[code](message)
geopy.exc.GeocoderInsufficientPrivileges: HTTP Error 403: Forbidden

标签: geopy

解决方案


“GeocoderInsufficientPrivileges”错误 - 尝试使用“Photon”而不是“Nominatim”

from geopy.geocoders import Photon
geolocator = Photon(user_agent="measurements")

推荐阅读