RequestIdPolicy Class
A simple policy that sets the given request id in the header.
This will overwrite request id that is already defined in the request. Request id can be configured up front, where the request id will be applied to all outgoing operations, and additional request id can also be set dynamically per operation.
- Inheritance
-
azure.core.pipeline.policies._base.SansIOHTTPPolicyRequestIdPolicy
Constructor
RequestIdPolicy(**kwargs: dict)
Parameters
- request_id
- str
The request id to be added into header.
- auto_request_id
- bool
Auto generates a unique request ID per call if true which is by default.
Examples
Configuring a request id policy.
from azure.core.pipeline.policies import HeadersPolicy
request_id_policy = RequestIdPolicy()
request_id_policy.set_request_id('azconfig-test')
# Or headers can be added per operation. These headers will supplement existing headers
# or those defined in the config headers policy. They will also overwrite existing
# identical headers.
policies.append(request_id_policy)
client = PipelineClient(base_url=url, policies=policies)
request = client.get(url)
pipeline_response = client._pipeline.run(request, request_id="azconfig-test")
Methods
| on_request |
Updates with the given request id before sending the request to the next policy. |
| set_request_id |
Add the request id to the configuration to be applied to all requests. |
on_request
Updates with the given request id before sending the request to the next policy.
on_request(request: azure.core.pipeline.PipelineRequest) -> None
Parameters
set_request_id
Add the request id to the configuration to be applied to all requests.
set_request_id(value)
Parameters
Feedback
Submit and view feedback for