Skip to content

Python3#1

Open
zegkljan wants to merge 5 commits intopferate:python3from
zegkljan:python3
Open

Python3#1
zegkljan wants to merge 5 commits intopferate:python3from
zegkljan:python3

Conversation

@zegkljan
Copy link

I needed to use your Python3 version of oauth2client but I got into two issues which gave me errors. So I decided to fix them:

  • httplib2.Http's request() method in python3 returns the content as bytes instead of str (as it was in python2) which caused _parse_exchange_token_response(content) to fail because the inner json parsing machinery checks if the content is of type str. To fix this I simply converted it to str using utf-8.
  • _urlsafe_b64decode() function wrongly concatenated bytes (which came from calling encode() on the b64string argument) with a str (created by multiplying the string "="). I fixed this by concatenating bytes and at the end converting to str using utf-8.

@pferate
Copy link
Owner

pferate commented Jul 16, 2014

Thanks for your input. The goal of this branch is to have a code base that works in both Python 2.6+ and Python 3.2+. As is, your code only works in Python3. Some minor changes to your usage of str() will be needed to have it work in both versions.

@pferate
Copy link
Owner

pferate commented Jul 16, 2014

Also have you filled out Google's CLA (Contributor License Agreements)? I will need to have you submit one before I can accept your pull requests. Thanks!

@zegkljan
Copy link
Author

Oh, I see and didn't realize. I'll fix it to work with Python 2.6+ too. And regarding the CLA I haven't filled out anything. I just hopped on your code and made those few changes :). I'll look into it in details, fill out the CLA and come back later. Thanks for pointing those things out.

@zegkljan
Copy link
Author

Ok, I fixed it to work in 2.6 (2.6.9 on my local machine) using bytes.decode() instead of using str() constructor. I have also filled out the CLA.

pferate pushed a commit that referenced this pull request Mar 30, 2015
Pull recent auth2client release (crypt + timeout)
pferate pushed a commit that referenced this pull request Jun 27, 2016
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.

2 participants

Comments