Skip to content

Commit

Permalink
Use non-open Mapquest geocoding API.
Browse files Browse the repository at this point in the history
It looks like there are issues with API Key auth for the open
data version.  For now, use the non-open version.

See
http://developer.mapquest.com/web/products/open/forums/-/message_boards/view_message/773296
  • Loading branch information
ghing committed Jun 26, 2014
1 parent f57b45b commit e480250
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions convictions_data/geocoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ def batch_geocode(self, queries, exactly_one=True, timeout=None):
# Don't include URL to a thumbnail map to make the payloads smaller
params.append(('thumbMaps', 'false'))

url = "{}://open.mapquestapi.com/geocoding/v1/batch?outFormat=json".format(
# TODO Switch back to open.mapquestapi.com domain once API Key issues
# are fixed. See
# http://developer.mapquest.com/web/products/open/forums/-/message_boards/view_message/773296
#url = "{}://open.mapquestapi.com/geocoding/v1/batch?outFormat=json".format(
# self.scheme)
url = "{}://www.mapquestapi.com/geocoding/v1/batch?outFormat=json".format(
self.scheme)
# The key is already urlencoded, so just append it at the end
url = "&".join((url, urlencode(params), "key={}".format(self.api_key)))
print(url)
data = self._call_geocoder(url, timeout=timeout)
return self._batch_parse_json(data['results'], exactly_one)

Expand Down

0 comments on commit e480250

Please sign in to comment.