RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1785607 - Package packages is no longer available - import produces AttributeError
Summary: Package packages is no longer available - import produces AttributeError
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python-requests
Version: 7.7
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Charalampos Stratakis
QA Contact: RHEL CS Apps Subsystem QE
URL:
Whiteboard:
Depends On:
Blocks: 1811048 1811049 1811050 1811051
TreeView+ depends on / blocked
 
Reported: 2019-12-20 12:43 UTC by Pavol Babinčák
Modified: 2023-09-07 21:19 UTC (History)
10 users (show)

Fixed In Version: python-requests-2.6.0-10.el7
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 1811048 1811049 1811050 1811051 (view as bug list)
Environment:
Last Closed: 2020-09-29 19:39:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:3886 0 None None None 2020-09-29 19:40:31 UTC


Description Pavol Babinčák 2019-12-20 12:43:47 UTC
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:

Comment 2 Miro Hrončok 2019-12-20 13:05:00 UTC
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

Comment 5 Petr Viktorin (pviktori) 2020-01-28 14:51:50 UTC
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.

Comment 6 Pavol Babinčák 2020-02-07 08:37:07 UTC
(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.

Comment 19 Richard 2020-04-10 07:51:56 UTC
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.

Comment 20 Petr Viktorin (pviktori) 2020-04-14 08:37:55 UTC
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.

Comment 21 Jan Houska 2020-05-22 11:25:34 UTC
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

Comment 23 errata-xmlrpc 2020-09-29 19:39:41 UTC
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


Note You need to log in before you can comment on or make changes to this bug.