Skip to content

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

Merged
merged 3 commits into from
Sep 13, 2017
Merged

Conversation

ssshah86
Copy link
Collaborator

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.

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'>
@schickling
Copy link
Contributor

Thanks a lot for this great contribution!

@schickling schickling merged commit 19c087a into prisma-labs:master Sep 13, 2017
@rcy
Copy link

rcy commented Sep 21, 2017

Does the version need to be bumped in setup.py and a new version uploaded to pypi?

@ssshah86
Copy link
Collaborator Author

Yes, I believe the graphcool team is pretty busy and will get to that soon.

@schickling
Copy link
Contributor

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?

@ssshah86
Copy link
Collaborator Author

<python setup.py register -r pypi>
and
<python setup.py sdist upload -r pypi>

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

@schickling
Copy link
Contributor

This is what I'm getting here. Can I add you as a collaborator somehow?

image

@ssshah86
Copy link
Collaborator Author

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 pypi.org instead of pypi.python.org, which was shut down July 3rd.

What's the repository information in your .pypirc file? If you upgrade you can delete the line starting with repository and you will use your upload tool’s default URL.

OR you can also use twine by installing it via pip3 install twine, which should be version 1.9.x. Then after you build your source dist, you can use twine upload --repository testpypi dist/* where the --repository flag will read from your .pypirc file.

@schickling
Copy link
Contributor

Added you as an owner on PyPI!

@ssshah86
Copy link
Collaborator Author

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

@ssshah86
Copy link
Collaborator Author

you can uninstall and reinstall to avoid the error

@rcy
Copy link

rcy commented Sep 27, 2017

Just installed 0.2.0 here, everything is working great... thank you both for your work!

@ssshah86 ssshah86 deleted the patch-1 branch May 7, 2018 00:45
alaptseu pushed a commit to alaptseu/python-graphql-client that referenced this pull request Jul 18, 2018
JorgeJuarezM pushed a commit to JorgeJuarezM/python-graphql-client that referenced this pull request Feb 21, 2023
1. client.execute() now returns json payload instead of string 2. Inc…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants