-
Notifications
You must be signed in to change notification settings - Fork 46
Fixed to support python 3 #2
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
Conversation
urllib2 doesn't exist within python3. The proposed changes should be compatible with python2 and 3, tested on 2.7.13 and 3.6.0.
OK this works in python 2 and python 3. However in python 2 it returns a unicode type and in python 3 a string class. It is also dependent on six.moves, so a dependency for six will need to be added. Using six is the easiest way to deal with urllib2 changes form Python2 to Python3. I can use the requests library if you guys prefer. I tested this against my own Gcool endpoint. These IDs will be deleted so I don't mind them in the public view. Python 3 returned: {"data":{"allDevices":[{"id":"cj65hnfrr34u00135z8l3glfq"},{"id":"cj65jm5kr3n6101350sfhk58t"},{"id":"cj65mdwpx0art0152rydd3yzy"},{"id":"cj65mg1sy0aum01529ro6x9h6"},{"id":"cj65mg6s30aut0152irb5j1th"}]}} The type is <class 'str'> Python 2 returned: {"data":{"allDevices":[{"id":"cj65hnfrr34u00135z8l3glfq"},{"id":"cj65jm5kr3n6101350sfhk58t"},{"id":"cj65mdwpx0art0152rydd3yzy"},{"id":"cj65mg1sy0aum01529ro6x9h6"},{"id":"cj65mg6s30aut0152irb5j1th"}]}} The type is <type 'unicode'>
Thanks a lot for this great contribution! |
Does the version need to be bumped in |
Yes, I believe the graphcool team is pretty busy and will get to that soon. |
It's been a while since we've dealt with Python packages the last time. What's the command needed to publish a new version @ssshah86? |
But @rcy is right, the version should be incremented first otherwise PyPI will reject it. see: http://sherifsoliman.com/2016/09/30/Python-package-with-GitHub-PyPI/#release-testing |
Yea my PyPI u/n is ssshah86, but I believe you have to update it in setup.py for me to be a maintainer though. I think it's the version of Python you are using, 3.5.2. There's an update in distutils for 3.5.3 that uploads to What's the repository information in your OR you can also use twine by installing it via |
Added you as an owner on PyPI! |
Thanks. Just uploaded v0.2.0. Everything looks great. There's one issue when upgrading on OSX when installing something with a dependency on the package 'six', detailed here: pypa/pip#3165 |
you can uninstall and reinstall to avoid the error |
Just installed 0.2.0 here, everything is working great... thank you both for your work! |
Fixed to support python 3
1. client.execute() now returns json payload instead of string 2. Inc…
urllib2 doesn't exist within python3. The proposed changes should be compatible with python2 and 3, tested on 2.7.13 and 3.6.0.
Sorry looks like I commited this early without running more tests, let me refine & push a new update to fix compatibility with both Python2 and 3.