Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Python3 support #51
Conversation
hades
added some commits
Feb 10, 2011
|
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 |
hades
commented
Feb 25, 2011
|
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 :) |
gorakhargosh
commented
Jul 5, 2011
|
I think a major portion of the library Using absolute imports may be useful. Cheers. |
and others
added some commits
Aug 12, 2011
takluyver
commented
Jan 9, 2012
|
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. |
gorakhargosh
commented
Jan 10, 2012
|
I've been writing one here at Have a look if you're interested. Cheers, =) |
takluyver
commented
Jan 10, 2012
|
@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. |
takluyver
reviewed
Apr 10, 2012
| 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()) |
takluyver
reviewed
Apr 10, 2012
| try: | ||
| query = base_url.query | ||
| except AttributeError: | ||
| # must be python <2.5 | ||
| query = base_url[4] | ||
| query = parse_qs(query) | ||
| - for k, v in self.items(): | ||
| + for k, v in list(self.items()): |
takluyver
reviewed
Apr 10, 2012
| @@ -721,7 +720,7 @@ def _get_signature_method(self, request): | ||
| # Get the signature method object. | ||
| signature_method = self.signature_methods[signature_method] | ||
| except: | ||
| - signature_method_names = ', '.join(self.signature_methods.keys()) | ||
| + signature_method_names = ', '.join(list(self.signature_methods.keys())) |
takluyver
commented
Apr 10, 2012
|
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! |
joestump
added
the
PY3K
label
Jul 29, 2015
|
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! |
hades commentedFeb 10, 2011
This adds support for Python3. All tests run successfully.