Description of problem: Recent change to python-requests broke interface that is used in many code bases. Previously top level requests packages could have been imported and package "packages" was made available. Code that is used in large amount of projects over the internet (e.g. https://programtalk.com/python-examples/requests.packages.urllib3.disable_warnings/ ) now fails on exception AttributeError. Version-Release number of selected component (if applicable): python-requests-2.6.0-8.el7_7 How reproducible: Always Steps to Reproduce: 1. Run code python -c 'import requests; requests.packages' 2. 3. Actual results: Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'module' object has no attribute 'packages' Expected results: No traceback and package "packages" is available in a followup code. Additional info:
While this was probably never a documented API, it is indeed used in the wild and removing it breaks things. Upstream added this hideous hack to have it back: https://github.com/psf/requests/blob/v2.18.0/requests/packages.py
We are planning to make `import requests.packages` possible and safe. However, `import requests; requests.packages` will not be possible without significant slowdown for everyone who imports requests. Will that be OK for you? The code seems fixed on your side.
(In reply to Petr Viktorin from comment #5) > We are planning to make `import requests.packages` possible and safe. > However, `import requests; requests.packages` will not be possible without > significant slowdown for everyone who imports requests. > > Will that be OK for you? The code seems fixed on your side. I guess it is your call. I cannot speak for everyone.
We had the same issue: code breaking because requests.packages.urllib3.disable_warnings() was suddenly no longer available after an upgrade. It took me a long time to find this bug report. Is this at al related to https://access.redhat.com/errata/RHBA-2020:0781 ? Because it looks like it is fixed now.
Yes, RHBA-2020:0781 has the fix for RHEL 7.5, 7.6 and 7.7. This bug tracks inclusion of the fix in future RHEL7 versions.
VERIFIED NEW PASS: python-requests-2.6.0-10.el7.noarch # rpm -qa python-requests python-requests-2.6.0-10.el7.noarch # python -c 'import requests; requests.packages' # echo $? 0 OLD FAIL: python-requests-2.6.0-8.el7_7.noarch # rpm -qa python-requests python-requests-2.6.0-8.el7_7.noarch # python -c 'import requests; requests.packages' Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'module' object has no attribute 'packages' # echo $? 1
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (python-requests bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:3886