From 4802f2fb8b87fedabd480a4fa57c4039bdd1b012 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Moreno Date: Wed, 10 May 2023 09:18:57 +0200 Subject: [PATCH] Support urllib3 >= 2.0.0 The urllib3.request.RequestMethods has been moved to urllib3._request_methods.RequestMethods. This patch changes the usage to continue working with the latest release, but now it's a "private" class in a "private" module, so maybe it's worth to start to think about updating this code to use the public API. https://urllib3.readthedocs.io/en/stable/changelog.html#removed --- google/auth/transport/urllib3.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/google/auth/transport/urllib3.py b/google/auth/transport/urllib3.py index bc4de4d14..5189da677 100644 --- a/google/auth/transport/urllib3.py +++ b/google/auth/transport/urllib3.py @@ -90,8 +90,8 @@ class Request(transport.Request): credentials.refresh(request) Args: - http (urllib3.request.RequestMethods): An instance of any urllib3 - class that implements :class:`~urllib3.request.RequestMethods`, + http (urllib3._request_methods.RequestMethods): An instance of any urllib3 + class that implements :class:`~urllib3._request_methods.RequestMethods`, usually :class:`urllib3.PoolManager`. .. automethod:: __call__ @@ -192,8 +192,9 @@ class AuthorizedHttp(urllib3._request_methods.RequestMethods): # type: ignore response = authed_http.request( 'GET', 'https://www.googleapis.com/storage/v1/b') - This class implements :class:`urllib3.request.RequestMethods` and can be - used just like any other :class:`urllib3.PoolManager`. + This class implements + :class:`urllib3._request_methods.RequestMethods` and can be used + just like any other :class:`urllib3.PoolManager`. The underlying :meth:`urlopen` implementation handles adding the credentials' headers to the request and refreshing credentials as needed.