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

fix(api) #502

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions googlemaps/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,19 +516,18 @@ def urlencode_params(params):


try:
unicode
# NOTE(cbro): `unicode` was removed in Python 3. In Python 3, NameError is
# raised here, and caught below.
# raised here, and caught below.

def normalize_for_urlencode(value):
"""(Python 2) Converts the value to a `str` (raw bytes)."""
if isinstance(value, unicode):
return value.encode('utf8')

if isinstance(value, str):
return value

return normalize_for_urlencode(str(value))
if(int(sys.version[0])<=2):
"""(Python 2) Converts the value to a `str` (raw bytes)."""
if isinstance(value, str):
return value
else:
return value.encode('utf8')
else:
return value.encode('utf-8')

except NameError:
def normalize_for_urlencode(value):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool:pytest]
addopts = -rsxX --cov=googlemaps --cov-report=
addopts = -rsxX

[coverage:run]
omit =
Expand Down