Teplitsa / MikroAct

Repository of the MikroAct project. So far, this is a closed repository.
1 stars 0 forks source link

Saving a new MikroAct throws a GBadKeyError #15

Closed jcdk closed 11 years ago

jcdk commented 11 years ago

The posted error was as follows:

Request Method: POST Request URL: http://127.0.0.1:8000/act/add/

File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)
File "/Library/Python/2.7/site-packages/guardian/mixins.py" in dispatch
  173.             **kwargs)
File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in dispatch
  86.         return handler(request, *args, **kwargs)
File "/Library/Python/2.7/site-packages/django/views/generic/edit.py" in post
  199.         return super(BaseCreateView, self).post(request, *args, **kwargs)
File "/Library/Python/2.7/site-packages/django/views/generic/edit.py" in post
  165.             return self.form_valid(form)
File "/Users/deklerk/Documents/Apps/MikroAct/acts/views.py" in form_valid
  107.         mikroact.save()
File "/Users/deklerk/Documents/Apps/MikroAct/acts/models.py" in save
  48.             self.location_lat, self.location_lon = geocoders.Google().geocode(self.location_address)[1]
File "/Library/Python/2.7/site-packages/geopy/geocoders/google.py" in geocode
  81.         return self.geocode_url(url, exactly_one)
File "/Library/Python/2.7/site-packages/geopy/geocoders/google.py" in geocode_url
  88.         return dispatch(page, exactly_one)
File "/Library/Python/2.7/site-packages/geopy/geocoders/google.py" in parse_xml
  107.             self.check_status_code(status_code)
File "/Library/Python/2.7/site-packages/geopy/geocoders/google.py" in check_status_code
  168.             raise GBadKeyError("The api_key is either invalid or does not match the domain for which it was given.")

Exception Type: GBadKeyError at /act/add/
Exception Value: The api_key is either invalid or does not match the domain for which it was given.```
supervacuo commented 11 years ago

An updated geopy gives a ValueError instead:

ValueError: Thegeocoders.google.Google(V2) API now requires theapi_keyargument. Please acquire and use an API key (http://goo.gl/EdoHX) or upgrade to the V3 API (geocoders.googlev3.GoogleV3), which does not require a key. ---- Please note that the V2 API is deprecated and may not work after March 2013 or September 2013.

The solution is to switch to geopy.geocoders.GoogleV3, which is now done with 3789891. Please close this ticket if that (plus pip install -r requirements.txt) solves the issue for you.