msrest-for-python icon indicating copy to clipboard operation
msrest-for-python copied to clipboard

A warning is logged while using msrest where urllib3 issues: DeprecationWarning: Using 'method_whitelist' with Retry is deprecated and will be removed in v2.0. Use 'allowed_methods' instead

Open harneetvirk opened this issue 3 years ago • 0 comments

A warning is logged while using msrest where urllib3 issues DeprecationWarning about using 'method_whitelist' with Retry

DeprecationWarning: Using 'method_whitelist' with Retry is deprecated and will be removed in v2.0. Use 'allowed_methods' instead

Here is the code: https://github.com/Azure/msrest-for-python/blob/98e2ebe7e5ed8a656f333963339ad8d20fc330d3/msrest/universal_http/requests.py#L353

Proposal is to allow use of both parameters based on the version of the urllib3 like inline:

if urllib3_version < "1.26.0":

DEFAULT_RETRY = Retry(
    total=MAX_RETRY,
    backoff_factor=RETRY_BACKOFF_FACTOR,

method_whitelist=RETRY_METHODS, status_forcelist=RETRY_STATUS_CODES, raise_on_status=False, ) else: DEFAULT_RETRY = Retry( total=MAX_RETRY, backoff_factor=RETRY_BACKOFF_FACTOR, allowed_methods=RETRY_METHODS, status_forcelist=RETRY_STATUS_CODES, raise_on_status=False, )

harneetvirk avatar Mar 26 '21 18:03 harneetvirk