1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
From 9ed006d02d7c9de3e6898ee819648c2fd3367c1d Mon Sep 17 00:00:00 2001
From: Daniel Garcia Moreno <daniel.garcia@suse.com>
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 | 11 ++++++-----
setup.py | 2 +-
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/google/auth/transport/urllib3.py b/google/auth/transport/urllib3.py
index 4abc26b52..f1dd35320 100644
--- a/google/auth/transport/urllib3.py
+++ b/google/auth/transport/urllib3.py
@@ -95,8 +95,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__
@@ -184,7 +184,7 @@ def _make_mutual_tls_http(cert, key):
return http
-class AuthorizedHttp(urllib3.request.RequestMethods):
+class AuthorizedHttp(urllib3._request_methods.RequestMethods):
"""A urllib3 HTTP class with credentials.
This class is used to perform requests to API endpoints that require
@@ -197,8 +197,9 @@ class AuthorizedHttp(urllib3.request.RequestMethods):
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.
diff --git a/setup.py b/setup.py
index e45512a02..cfb3b504f 100644
--- a/setup.py
+++ b/setup.py
@@ -32,1 +32,1 @@
- "urllib3<2.0",
+ "urllib3>=2.0",
|