AsyncRedirectPolicy Class
An async redirect policy.
An async redirect policy in the pipeline can be configured directly or per operation.
- Inheritance
-
azure.core.pipeline.policies._redirect.RedirectPolicyBaseAsyncRedirectPolicyazure.core.pipeline.policies._base_async.AsyncHTTPPolicyAsyncRedirectPolicy
Constructor
AsyncRedirectPolicy(**kwargs)
Parameters
- permit_redirects
- bool
Whether the client allows redirects. Defaults to True.
- redirect_max
- int
The maximum allowed redirects. Defaults to 30.
Examples
Configuring an async redirect policy.
from azure.core.pipeline.policies import AsyncRedirectPolicy
redirect_policy = AsyncRedirectPolicy()
# Client allows redirects. Defaults to True.
redirect_policy.allow = True
# The maximum allowed redirects. The default value is 30
redirect_policy.max_redirects = 10
# Alternatively you can disable redirects entirely
redirect_policy = AsyncRedirectPolicy.no_redirects()
# It can also be overridden per operation.
async with AsyncPipelineClient(base_url=url, policies=[redirect_policy]) as client:
response = await client._pipeline.run(request, permit_redirects=True, redirect_max=5)
Methods
| send |
Sends the PipelineRequest object to the next policy. Uses redirect settings to send the request to redirect endpoint if necessary. |
send
Sends the PipelineRequest object to the next policy. Uses redirect settings to send the request to redirect endpoint if necessary.
async send(request)
Parameters
Returns
Returns the PipelineResponse or raises error if maximum redirects exceeded.
Return type
Exceptions
Feedback
Submit and view feedback for