geolocation-python icon indicating copy to clipboard operation
geolocation-python copied to clipboard

No longer working

Open jamesbcn opened this issue 4 years ago • 2 comments

The application at my work stopped working a couple of months ago.

I tested the API key using the URL request given by Google and it still works:

https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=API-KEY-HERE

However, the following code in 2.7.9 returns a "Python Request Denied" error using the same address and API:

from geolocation.main import GoogleMaps from geolocation.distance_matrix.client import DistanceMatrixApiClient

address = "1600 Amphitheatre Parkway, Mountain View, CA"

google_maps = GoogleMaps(api_key="API-KEY-HERE")

location = google_maps.search(location=address)

print location.all()

my_location = location.first()

print my_location.postal_code

jamesbcn avatar Jan 13 '21 23:01 jamesbcn

@jamesbcn, I think I am having the same issue. It seems that the api key is not being appended to the URL. geolocation.exceptions.ApiClientException: Request was denied. Is this what happens to you?

hprovenza avatar May 27 '22 19:05 hprovenza

I replaced the libraries with googlemaps.


import googlemaps

gmaps = googlemaps.Client(key='API-KEY-HERE')

jamesbcn avatar May 27 '22 19:05 jamesbcn