Polyconseil/py-googlemaps — pull request #1 by nicolas-pantel (2014-11-07 12:46:44+00:00)
Title: fix urlencode

erreur après modif:

Traceback (most recent call last):
File "test/test_googlemaps.py", line 49, in test_geocode
results = gmaps.geocode(addr)
File "/home/dev-polyconseil/autolib/py-googlemaps/googlemaps/googlemaps.py", line 237, in geocode
self._GEOCODE_QUERY_URL, params=params, client_id=self.client_id, secret_key=self.secret_key)
File "/home/dev-polyconseil/autolib/py-googlemaps/googlemaps/googlemaps.py", line 65, in fetch_json
params = dict((k.decode('utf8'), v.decode('utf8')) for k, v in params.items())
File "/home/dev-polyconseil/autolib/py-googlemaps/googlemaps/googlemaps.py", line 65, in
params = dict((k.decode('utf8'), v.decode('utf8')) for k, v in params.items())
File "/home/dev-polyconseil/virtualenv/py-googlemaps/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 12: ordinal not in range(128)

erreur avant modif:

File "autoslave/util/selftest/views.py", line 74, in do_geocode
forward = geocoding.geocode(u"5 rue Édouard VII, 75009 Paris", timeout=3)
File "bluetils/geo/geocoding.py", line 30, in geocode
return backend.geocode(full_address, include_address=include_address)
File "bluetils/geo/backends/gmaps.py", line 110, in geocode
results = self.gmaps.geocode(full_address)
File "python2.6/googlemaps.py", line 235, in geocode
self._GEOCODE_QUERY_URL, params=params, client_id=self.client_id, secret_key=self.secret_key)
File "python2.6/googlemaps.py", line 64, in fetch_json
encoded_params = urlencode(params)
File "python2.6/urllib.py", line 1269, in urlencode
v = quote_plus(str(v))