google-auth-library-python icon indicating copy to clipboard operation
google-auth-library-python copied to clipboard

Enable caller provide customized request session for authentication request.

Open shileiyu opened this issue 7 years ago • 1 comments

Hardcode a new session dedicated for authentication request make the user hard to customize the requests session object. (for example, proxy)

https://github.com/GoogleCloudPlatform/google-auth-library-python/blob/edfe24602051969e32917e82bcedd2bace43e260/google/auth/transport/requests.py#L167

shileiyu avatar Jun 29 '18 18:06 shileiyu

@theacodes I ran into this issue when working with a proxy and can send a fix, but I wasn't sure how to provide the correct fix.

We could stay consistent with what urllib3.py does and allow a Session object to be passed through to __init__ and use that as self._auth_request. We can then just default to the original base Session object.

As an aside, the requests.Session object doesn't allow kwargs, so I'm not sure if we want to allow that or if we do, then we can also consider propagating kwargs into self and auth_request_session.

brianbao avatar Oct 26 '18 18:10 brianbao