-
Notifications
You must be signed in to change notification settings - Fork 911
Python3 support #51
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
Python3 support #51
Conversation
Hi! Thank you for the patch. I'm not sure how to best take advantage of it, though, because I can't abandon support for Python 2, and I don't want to support two codebases. Is it possible to make a single codebase that works in both Python 2 and Python 3, perhaps by using the six library? http://packages.python.org/six/ Regards, Zooko |
Uhm... I don't think six is a good idea. Can you, perhaps, just push it as a separate branch, so people know it is there? Or I can perhaps take over the support for python 3 variant until such time comes that no one needs python 2 anymore :) |
I think a major portion of the library Using absolute imports may be useful. Cheers. |
the original port had both oauth_body_hash and oauth_signature as bytestrings. this caused the request to be sent out with those fields enclosed in b''. This caused POST requests to fail for me, not sure why GET requests worked.
make sure oauth headers are not bytestrings
I'm willing to look into a Python 2 & 3 port. What's the minimum version of Python 2 which must be supported? The job gets substantially easier with only Python 2.6. |
I've been writing one here at Have a look if you're interested. Cheers, =) |
@gorakhargosh : I think it makes sense to focus on python-oauth2, because many people are already using it (going by PyPI download counts), and they'll be reluctant to port their code to another OAuth library in order to use Python 3. |
if not k.startswith('oauth_')]) | ||
|
||
def to_header(self, realm=''): | ||
"""Serialize as a header for an HTTPAuth request.""" | ||
oauth_params = ((k, v) for k, v in self.items() | ||
oauth_params = ((k, v) for k, v in list(self.items()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list()
shouldn't be needed here.
So what would need doing to support Python 2 & 3 from one codebase? The options are roughly:
|
@jaitaiwan can you take a look at this? It's related to #158. @hades thanks for the PR! 🎉 |
This one fails to work in Pyk2 so I think we may drop it https://travis-ci.org/CentricWebEstate/python-oauth2/jobs/75874253 Thoughts @rickhanlonii @joestump? |
Yeah, there are other pk3 wips that are farther along at this point. Thanks for the contribution @hades! |
This adds support for Python3. All tests run successfully.