Skip to content
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.

Update library to be python3.6 compatible #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jmichelsen
Copy link

No description provided.

@jmichelsen
Copy link
Author

I know pr #32 exists to convert the repo to python3 using the 2to3 utility. I converted this manually to allow it to remain backwards compatible with python2.6 and python2.7. Cheers.

@@ -61,7 +66,9 @@ def request(self, method, url, data={}, response='body'):
raise APIException(
'{0}: {1}'.format(error_type, error_msg))

if response == 'body' and isinstance(content, str):
if isinstance(content, six.binary_type):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Looks good aside from needing to pull in six as a requirement. Can you check this without it?

An example from http://python3porting.com/noconv.html#more-bytes-strings-and-unicode:

>>> from __future__ import unicode_literals
>>> import sys
>>> if sys.version_info < (3,):
...     text_type = unicode
...     binary_type = str
... else:
...     text_type = str
...     binary_type = bytes
>>> isinstance('U\xf1ic\xf6de', text_type)
True

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'll update this

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

Successfully merging this pull request may close these issues.

2 participants