-
Notifications
You must be signed in to change notification settings - Fork 314
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
External transport discussion #15
Comments
I like what you've constructed above. |
Yay! Any thoughts on this:
|
Long import paths don't bother me. You can make |
How so? Import all the submodules? |
Yes. |
@jonparrott Is this the expected pattern for people to follow when they need to attach a custom http object to a google.auth.default() request? I'm trying to sort out how to run google-auth through a proxy; using a proxy is a pretty common use case, so if this is the right way to do it, some documentation pointers would be very helpful here: https://google-auth.readthedocs.io/en/latest/user-guide.html |
If you're using a proxy and the requests transport you can just set the standard |
Some media download APIs does not support partial downloads and do not return a 'Content-length' or 'Content-range' header and is therefore never considered done. This change is to consider responses where the media length is unknown to be done. This commit could potentially break media downloads where the API supports partial download and only returns a 'Content-length' header when the entire file has been served/read. This commit fixes issue googleapis#15
Continuing from #1, we need to figure out the story for use case (2):
The usage of this is external-only. This is the means by which users will make authenticated requests. We want to initially support
urllib3
, but we should be aware of anything that will cause issues with arequests
implementation.How oauth2client does this
oauth2client only supports
httplib2
. The way that it accomplishes this is by monkeypatching an existinghttplib2.Http
object'srequest
method.http.request.func_closure[0].cell_contents
, which is insanity).How oauth2client's transport refactor did it.
In the transport refactor, I modified this behavior slightly. Instead of monkeypatching, it wrapped the http object using an
AuthedHttp
wrapper class that has a common interface withhttplib2.Http
.AuthedHttp
wrapper instance that uses the original http object under the covers. The original http object is not modified in any way.What we could do
We could largely adopt the second method without much heartache, as long a we're still okay with the wrapper pattern:
Similarly with requests:
We could also have these items construct their own underlying object using sane defaults if none is specified:
The only concern I have about this is the long import path (
google.auth.transport.urllib3
). I can't think of a good, clean way to do something like oauth2client'sauthorize
and I'm not sure that I want to.Thoughts? Concerns? Alternatives?
The text was updated successfully, but these errors were encountered: