PipelineClient Class

Service client core methods.

Builds a Pipeline client.

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

Constructor

PipelineClient(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[HTTPPolicy]

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

per_call_policies
<xref:Union>[HTTPPolicy, SansIOHTTPPolicy, list[HTTPPolicy], list[SansIOHTTPPolicy]]

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

per_retry_policies
<xref:Union>[HTTPPolicy, SansIOHTTPPolicy, list[HTTPPolicy], list[SansIOHTTPPolicy]]

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

transport
HttpTransport

If omitted, RequestsTransport is used for synchronous transport.

Examples

Builds the pipeline client.


   from azure.core import PipelineClient
   from azure.core.pipeline.policies import RedirectPolicy, UserAgentPolicy

   # example configuration with some policies
   policies = [
       UserAgentPolicy("myuseragent"),
       RedirectPolicy()
   ]

   client = PipelineClient(base_url=url, policies=policies)
   request = client.get("https://bing.com")

   pipeline_response = 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 = client.send_request(request)
<HttpResponse: 200 OK>

close

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 = client.send_request(request)
<HttpResponse: 200 OK>
send_request(request: HTTPRequestType, **kwargs: Any) -> HTTPResponseType

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