2016-04-13 14 views
3

Yaklaşık iki ay boyunca bir python projesi için geopy kullanıyorum. Kodu bir seferde 100 kez aldım. Bu yüzden onu kötüye kullandım sanmıyorum.Geopy hatası ve zaman aşımı

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

Nasıl "yeterli Ayrıcalıklar" alabilirsiniz:

Dün aşağıdaki hatayı alıyorum bir zaman aşımı hatası ve bugün başlamıştı? Bu işi yapmak için nasıl e-posta veya ödeme yapabileceğimi bilen var mı?

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"  

cevap

2

Nominatim çalışmayı durdurdu Sanırım GoogleV3 kullandım. Bu, Adres için daha az bilgi döndürür, ancak yine de işe yarayabilir.

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"  
+0

GoogleV3 ile rasgele zaman aşımlarını görüyorum, bir günde 2500 sorguya kadar yapabilirsiniz. Bir cron işini doğru bir şekilde ayarlamadığım zaman sınırı çarptı. –