jeffkrop
jeffkrop

Reputation: 147

Geopy error and timeout

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"    

Upvotes: 3

Views: 2318

Answers (1)

jeffkrop
jeffkrop

Reputation: 147

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"    

Upvotes: 2

Related Questions