Pipeline Class

A pipeline implementation.

This is implemented as a context manager, that will activate the context of the HTTP sender. The transport is the last node in the pipeline.

Inheritance
Pipeline

Constructor

Pipeline(transport: HttpTransportType, policies: Optional[List[Union[azure.core.pipeline.policies._base.HTTPPolicy, azure.core.pipeline.policies._base.SansIOHTTPPolicy]]] = None)

Parameters

transport
Required

The Http Transport instance

policies
list
default value: None

List of configured policies.

Examples

Builds the pipeline for synchronous transport.


   from azure.core.pipeline import Pipeline
   from azure.core.pipeline.policies import RedirectPolicy, UserAgentPolicy
   from azure.core.pipeline.transport import RequestsTransport, HttpRequest

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

   # run the pipeline
   with Pipeline(transport=RequestsTransport(), policies=policies) as pipeline:
       response = pipeline.run(request)

Methods

run

Runs the HTTP Request through the chained policies.

run

Runs the HTTP Request through the chained policies.

run(request: HTTPRequestType, **kwargs: Any) -> azure.core.pipeline.PipelineResponse

Parameters

request
HttpRequest
Required

The HTTP request object.

Returns

The PipelineResponse object

Return type