Skip to content

Commit

Permalink
Changed urllib3.Retry.method_whitelist to allowed_methods
Browse files Browse the repository at this point in the history
Details:

* Changed use of 'method_whitelist' in urllib3.Retry to 'allowed_methods'.
  The old method was deprecated in urllib3 1.26.0 and removed in 2.0.0.
  Related to that, incrased the minimum versions of urllib3 to 1.26.5 and of
  requests to 2.25.0. (issue #1145)

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
  • Loading branch information
andy-maier committed May 5, 2023
1 parent 9f82ebe commit ae7c026
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
5 changes: 5 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ Released: not yet
* Addressed safety issues by increasing minimum versions of packages, where
possible.

* Changed use of 'method_whitelist' in urllib3.Retry to 'allowed_methods'.
The old method was deprecated in urllib3 1.26.0 and removed in 2.0.0.
Related to that, incrased the minimum versions of urllib3 to 1.26.5 and of
requests to 2.25.0. (issue #1145)

**Enhancements:**

* Disabled the default retrieval of the full set of properties in list()
Expand Down
6 changes: 2 additions & 4 deletions minimum-constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ wheel==0.38.1; python_version >= '3.7'
decorator==4.0.11
pytz==2016.10; python_version <= '3.9'
pytz==2019.1; python_version >= '3.10'
requests==2.22.0; python_version <= '3.9'
requests==2.25.0; python_version >= '3.10'
requests==2.25.0
six==1.14.0; python_version <= '3.9'
six==1.16.0; python_version >= '3.10'
stomp.py==4.1.23
Expand Down Expand Up @@ -128,8 +127,7 @@ chardet==3.0.3
docopt==0.6.2
idna==2.5
# urllib3 1.26.5 fixes safety issue 43975
urllib3==1.25.9; python_version <= '3.9'
urllib3==1.26.5; python_version >= '3.10'
urllib3==1.26.5
pyrsistent==0.15.0

# Direct dependencies for development (must be consistent with dev-requirements.txt)
Expand Down
5 changes: 1 addition & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ decorator>=4.0.11; python_version >= '3.5' # new BSD
pytz>=2016.10; python_version <= '3.9' # MIT
pytz>=2019.1; python_version >= '3.10' # MIT

# requests 2.22.0 removes the pinning of urllib3 to <1.25.0, and urllib 1.25.9
# is required to address safety issues
# requests 2.25.0 tolerates urllib3 1.26.5 which is needed on Python 3.10 to
# remove ImportWarning in six
requests>=2.22.0; python_version <= '3.9' # Apache-2.0
requests>=2.25.0; python_version >= '3.10' # Apache-2.0
requests>=2.25.0 # Apache-2.0

# six 1.16.0 removes the ImportWarning raised by Python 3.10
six>=1.14.0; python_version <= '3.9' # MIT
Expand Down
6 changes: 3 additions & 3 deletions zhmcclient/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ def __init__(self, connect_timeout=None, connect_retries=None,
self.name_uri_cache_timetolive = name_uri_cache_timetolive

# Read retries only for these HTTP methods:
self.method_whitelist = {'GET'}
self.allowed_methods = {'GET'}

_attrs = ('connect_timeout', 'connect_retries', 'read_timeout',
'read_retries', 'max_redirects', 'operation_timeout',
'status_timeout', 'name_uri_cache_timetolive',
'method_whitelist')
'allowed_methods')

def override_with(self, override_config):
"""
Expand Down Expand Up @@ -726,7 +726,7 @@ def _new_session(retry_timeout_config):
total=retry_timeout_config.connect_retries,
connect=retry_timeout_config.connect_retries,
read=retry_timeout_config.read_retries,
method_whitelist=retry_timeout_config.method_whitelist,
allowed_methods=retry_timeout_config.allowed_methods,
redirect=retry_timeout_config.max_redirects)
session = requests.Session()
session.mount('https://',
Expand Down

0 comments on commit ae7c026

Please sign in to comment.