Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Geopy error and timeout

Tags:

python

geopy

I have been using geopy for a python project for about two months. I have maybe used the code under 100 times getting one return at a time. So I don't think that I am abusing it in away.

Yesterday I was getting a timeout error and today I am getting the following error:

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

How can I get "sufficient Privileges"? Anyone know how I can email or pay to make this work?

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"    
like image 993
jeffkrop Avatar asked Mar 24 '26 05:03

jeffkrop


1 Answers

Nominatim has stopped working I guess so I used GoogleV3. This returns less information for the Address but it may still work.

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"    
like image 162
jeffkrop Avatar answered Mar 26 '26 17:03

jeffkrop



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!