3

Python プロジェクトで geopy を約 2 か月間使用しています。一度に 1 つのリターンを取得する 100 回未満のコードを使用した可能性があります。だから、私はそれを悪用しているとは思いません。

昨日はタイムアウト エラーが発生し、今日は次のエラーが発生しています。

geopy.exc.GeocoderInsufficientPrivileges: HTTP エラー 403: 禁止されています。

「十分な特権」を得るにはどうすればよいですか? これを機能させるためにメールや支払いをする方法を知っている人はいますか?

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"    
4

1 に答える 1

2

Nominatim が機能しなくなったので、GoogleV3 を使用しました。これにより、Address について返される情報は少なくなりますが、それでも機能する可能性があります。

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"    
于 2016-04-13T17:38:06.647 に答える