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

urllib3 update to version 2.0.2 causes errors #165

Closed
xavierBizoux opened this issue May 12, 2023 · 2 comments
Closed

urllib3 update to version 2.0.2 causes errors #165

xavierBizoux opened this issue May 12, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@xavierBizoux
Copy link
Contributor

Describe the issue
After upgrading urllib3 to version 2.0.2, sasctl fails to start a session.

To Reproduce
import getpass

from sasctl import Session
from sasctl.services import folders

server_name = "server.sas.com"
user = "sasdemo"
password = getpass.getpass()

with Session(server_name, user, password):
folders.list_folders()

Expected behavior
Display a list of folders

Stack Trace
Traceback (most recent call last):
File "/Users/sbxxab/gitRepos/python-sasctl/examples/test_urllib3.py", line 12, in
with Session(server_name, user, password):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbxxab/gitRepos/python-sasctl/src/sasctl/core.py", line 425, in init
self.auth = self._get_authorization_token(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbxxab/gitRepos/python-sasctl/src/sasctl/core.py", line 948, in _get_authorization_token
return self._request_token_with_oauth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbxxab/gitRepos/python-sasctl/src/sasctl/core.py", line 1346, in _request_token_with_oauth
response = super(Session, self).post(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbxxab/gitRepos/python-sasctl/.venv/lib/python3.11/site-packages/requests/sessions.py", line 635, in post
return self.request("POST", url, data=data, json=json, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbxxab/gitRepos/python-sasctl/src/sasctl/core.py", line 633, in request
r = super(Session, self).request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbxxab/gitRepos/python-sasctl/.venv/lib/python3.11/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbxxab/gitRepos/python-sasctl/src/sasctl/core.py", line 588, in send
response = super(Session, self).send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbxxab/gitRepos/python-sasctl/.venv/lib/python3.11/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbxxab/gitRepos/python-sasctl/.venv/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/Users/sbxxab/gitRepos/python-sasctl/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/Users/sbxxab/gitRepos/python-sasctl/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/Users/sbxxab/gitRepos/python-sasctl/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1092, in _validate_conn
conn.connect()
File "/Users/sbxxab/gitRepos/python-sasctl/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 635, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sbxxab/gitRepos/python-sasctl/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 809, in _ssl_wrap_socket_and_match_hostname
_match_hostname(
File "/Users/sbxxab/gitRepos/python-sasctl/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 833, in _match_hostname
stripped_hostname = asserted_hostname.strip("[]")
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'bool' object has no attribute 'strip'

Version
sasctl 1.9.1

@xavierBizoux xavierBizoux added the bug Something isn't working label May 12, 2023
@smlindauer smlindauer self-assigned this May 15, 2023
@smlindauer
Copy link
Collaborator

This is actually an issue with the requests package itself (see here) not yet supporting urllib3 v2.0.0+. I believe the requests package is waiting to see how urllib3 handles the failed backwards compatibility before attempting to push a major release update.

For the time being, I would downgrade the urllib3 package to <2.0.0 (pip install -U urllib3<2) or reinstall the requests package such that it can dictate their acceptable dependencies.

@smlindauer
Copy link
Collaborator

Looks like those errors also propagated to the automated tests. I just pushed bef7110 to adjust the tox.ini set up.

For the time being, I think it's fair to say that we should only be using urllib3<2.0.0 for anything utilizing requests (i.e. most of sasctl).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants