Skip to content

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 #237

Open
@harneetvirk

Description

@harneetvirk

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:

self.policy.method_whitelist = ['HEAD', 'TRACE', 'GET', 'PUT',

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,
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions