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
Required

If omitted, the standard configuration is used.

pipeline
<xref:Pipeline>
Required

If omitted, a Pipeline object is created and returned.

policies
list[<xref:HTTPPolicy>]
Required

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

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

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

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

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

transport
<xref:HttpTransport>
Required

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

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

This method is marked as provisional, meaning it may be changed in a future release.


>>> 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

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

This method is marked as provisional, meaning it may be changed in a future release.


>>> 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, **kwargs)

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