Skip to content

Commit

Permalink
fix: support urllib3<2.0 versions (#1390)
Browse files Browse the repository at this point in the history
* fix: support urllib3<2.0 versions

* update
  • Loading branch information
arithmetic1728 committed Sep 28, 2023
1 parent f33bb9d commit 07c464a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion google/auth/transport/urllib3.py
Expand Up @@ -40,11 +40,18 @@
"urllib3 package to use the urllib3 transport."
) from caught_exc

from packaging import version # type: ignore

from google.auth import environment_vars
from google.auth import exceptions
from google.auth import transport
from google.oauth2 import service_account

if version.parse(urllib3.__version__) >= version.parse("2.0.0"): # pragma: NO COVER
RequestMethods = urllib3._request_methods.RequestMethods # type: ignore
else: # pragma: NO COVER
RequestMethods = urllib3.request.RequestMethods # type: ignore

_LOGGER = logging.getLogger(__name__)


Expand Down Expand Up @@ -179,7 +186,7 @@ def _make_mutual_tls_http(cert, key):
return http


class AuthorizedHttp(urllib3._request_methods.RequestMethods): # type: ignore
class AuthorizedHttp(RequestMethods): # type: ignore
"""A urllib3 HTTP class with credentials.
This class is used to perform requests to API endpoints that require
Expand Down
1 change: 0 additions & 1 deletion setup.py
Expand Up @@ -25,7 +25,6 @@
# rsa==4.5 is the last version to support 2.7
# https://github.com/sybrenstuvel/python-rsa/issues/152#issuecomment-643470233
"rsa>=3.1.4,<5",
"urllib3>=2.0.5",
)

extras = {
Expand Down
Binary file modified system_tests/secrets.tar.enc
Binary file not shown.
1 change: 1 addition & 0 deletions testing/constraints-3.10.txt
@@ -0,0 +1 @@
urllib3<2.0.0
1 change: 1 addition & 0 deletions testing/constraints-3.11.txt
@@ -0,0 +1 @@
urllib3>2.0.0

0 comments on commit 07c464a

Please sign in to comment.