Google-api-python-client: Consider to change httplib2 to requests

Created on 15 Mar 2017  路  2Comments  路  Source: googleapis/google-api-python-client

[Status]
Currently using "google-api-python-client" with G Suite Admin SDK.
Need support for HTTP_PROXY, HTTPS_PROXY.

"httplib2" doesn't fully support Python3.
ex) https://github.com/httplib2/httplib2/blob/master/python2/httplib2/__init__.py#L904-L919
https://github.com/httplib2/httplib2/blob/master/python3/httplib2/__init__.py#L821-L822

How about considering changing library from httplib2 to requests?

triage me

Most helpful comment

@kimdwkimdw we would love to, but the problem is that httplib2 is just so deeply entrenched in this codebase that it's practically impossible without breaking the interface in ways that would greatly upset our existing users. This is a lesson hard-learned when we tried to do the same thing to oauth2client (which shares the same lineage), which is why we ended up creating a new library (google-auth) to support requests and gRPC.

I'll summarize the options here:

  1. Use the new Cloud Client Libraries: https://github.com/GoogleCloudPlatform/google-cloud-python
  2. Use this library with httplib2shim: https://github.com/GoogleCloudPlatform/httplib2shim
  3. Use google-auth and requests directly: http://google-auth.readthedocs.io/en/latest/user-guide.html#requests

All 2 comments

@kimdwkimdw we would love to, but the problem is that httplib2 is just so deeply entrenched in this codebase that it's practically impossible without breaking the interface in ways that would greatly upset our existing users. This is a lesson hard-learned when we tried to do the same thing to oauth2client (which shares the same lineage), which is why we ended up creating a new library (google-auth) to support requests and gRPC.

I'll summarize the options here:

  1. Use the new Cloud Client Libraries: https://github.com/GoogleCloudPlatform/google-cloud-python
  2. Use this library with httplib2shim: https://github.com/GoogleCloudPlatform/httplib2shim
  3. Use google-auth and requests directly: http://google-auth.readthedocs.io/en/latest/user-guide.html#requests

@jonparrott thanks for summarizing the options. The lesson is very impressive.

But, first option is not suitable for my case. (I think google-cloud library cannot cover all google-api-python-client)
Option 2 looks good for me.

Was this page helpful?
0 / 5 - 0 ratings