Skip to content
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

fix: support urllib3<2.0 versions #1390

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion google/auth/transport/urllib3.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
urllib3<2.0.0
1 change: 1 addition & 0 deletions testing/constraints-3.11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
urllib3>2.0.0