gpt4 book ai didi

python - Geopy 错误和超时

转载 作者:行者123 更新时间:2023-11-28 17:28:27 35 4
gpt4 key购买 nike

我已经将 geopy 用于 python 项目大约两个月了。我可能使用代码不到 100 次,一次获得一个返回。所以我不认为我在滥用它。

昨天我收到超时错误,今天我收到以下错误:

geopy.exc.GeocoderInsufficientPrivileges: HTTP Error 403: Forbidden.

如何获得“足够的权限”?任何人都知道我如何通过电子邮件或付款来完成这项工作?

from geopy.geocoders import Nominatim
import csv

def geopy():

loc = raw_input("What location? ")
geolocator = Nominatim()
location = geolocator.geocode(loc, timeout=None) # timeout is the amount of time it will wait for return
if location != None:
Address = location.address
lat_long = location.latitude,location.longitude

else:
print "There is no geographic information to return for the word in input. \n"

最佳答案

我猜 Nominatim 已经停止工作,所以我使用了 GoogleV3。这会返回较少的地址信息,但它可能仍然有效。

from geopy.geocoders import GoogleV3
def geopy():

loc = raw_input("What location? ")
geolocator = GoogleV3()
location = geolocator.geocode(loc)
if location != None:
Address = location.address
lat_long = location.latitude,location.longitude
print Address, lat_long

else:
print "There is no geographic information to return for the word in input. \n"

关于python - Geopy 错误和超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36599584/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com