AsyncPipeline Class

Async pipeline implementation.

This is implemented as a context manager, that will activate the context of the HTTP sender.

Inheritance
AsyncPipeline

Constructor

AsyncPipeline(transport, policies: Optional[List[Union[azure.core.pipeline.policies._base_async.AsyncHTTPPolicy, azure.core.pipeline.policies._base.SansIOHTTPPolicy]]] = None)

Parameters

transport
Required

The async Http Transport instance.

policies
list
default value: None

List of configured policies.

Examples

Builds the async pipeline for asynchronous transport.


   from azure.core.pipeline import AsyncPipeline
   from azure.core.pipeline.policies import AsyncRedirectPolicy, UserAgentPolicy
   from azure.core.pipeline.transport import AioHttpTransport, HttpRequest

   # example: create request and policies
   request = HttpRequest("GET", "https://bing.com")
   policies = [
       UserAgentPolicy("myuseragent"),
       AsyncRedirectPolicy()
   ]

   # run the pipeline
   async with AsyncPipeline(transport=AioHttpTransport(), policies=policies) as pipeline:
       response = await pipeline.run(request)

Methods

run

Runs the HTTP Request through the chained policies.

run

Runs the HTTP Request through the chained policies.

async run(request: HTTPRequestType, **kwargs: Any)

Parameters

request
HttpRequest
Required

The HTTP request object.

Returns

The PipelineResponse object.

Return type