AsyncPipelineClient Class

Service client core methods.

Builds an AsyncPipeline client.

Inheritance
azure.core.pipeline.transport._base.PipelineClientBase
AsyncPipelineClient

Constructor

AsyncPipelineClient(base_url, **kwargs)

Parameters

base_url
str
Required

URL for the request.

config
Configuration

If omitted, the standard configuration is used.

pipeline
Pipeline

If omitted, a Pipeline object is created and returned.

policies
list[AsyncHTTPPolicy]

If omitted, the standard policies of the configuration object is used.

per_call_policies
<xref:Union>[AsyncHTTPPolicy, <xref:azure.core.pipeline.policies.SansIOHTTPPolicy,list>[AsyncHTTPPolicy], list[SansIOHTTPPolicy]]

If specified, the policies will be added into the policy list before RetryPolicy

per_retry_policies
<xref:Union>[AsyncHTTPPolicy, <xref:azure.core.pipeline.policies.SansIOHTTPPolicy,list>[AsyncHTTPPolicy], list[SansIOHTTPPolicy]]

If specified, the policies will be added into the policy list after RetryPolicy

transport
AsyncHttpTransport

If omitted, AioHttpTransport is used for asynchronous transport.

Examples

Builds the async pipeline client.


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

   # example policies
   request = HttpRequest("GET", url)
   policies = [
       UserAgentPolicy("myuseragent"),
       AsyncRedirectPolicy(),
   ]

   async with AsyncPipelineClient(base_url=url, policies=policies) as client:
       response = await client._pipeline.run(request)

Methods

close
send_request

Method that runs the network request through the client's chained policies.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest('GET', 'http://www.example.com')
<HttpRequest [GET], url: 'http://www.example.com'>
>>> response = await client.send_request(request)
<AsyncHttpResponse: 200 OK>

close

async close()

send_request

Method that runs the network request through the client's chained policies.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest('GET', 'http://www.example.com')
<HttpRequest [GET], url: 'http://www.example.com'>
>>> response = await client.send_request(request)
<AsyncHttpResponse: 200 OK>
send_request(request: HTTPRequestType, *, stream: bool = False, **kwargs: Any) -> Awaitable[AsyncHTTPResponseType]

Parameters

request
HttpRequest
Required

The network request you want to make. Required.

stream
bool

Whether the response payload will be streamed. Defaults to False.

Returns

The response of your network call. Does not do error handling on your response.

Return type