Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer working #35

Open
jamesbcn opened this issue Jan 13, 2021 · 2 comments
Open

No longer working #35

jamesbcn opened this issue Jan 13, 2021 · 2 comments

Comments

@jamesbcn
Copy link

jamesbcn commented Jan 13, 2021

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

@hprovenza
Copy link

hprovenza commented May 27, 2022

@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?

@jamesbcn
Copy link
Author

I replaced the libraries with googlemaps.


import googlemaps

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants