SansIOHTTPPolicy Class

Represents a sans I/O policy.

SansIOHTTPPolicy is a base class for policies that only modify or mutate a request based on the HTTP specification, and do not depend on the specifics of any particular transport. SansIOHTTPPolicy subclasses will function in either a Pipeline or an AsyncPipeline, and can act either before the request is done, or after. You can optionally make these methods coroutines (or return awaitable objects) but they will then be tied to AsyncPipeline usage.

Inheritance
SansIOHTTPPolicy

Constructor

SansIOHTTPPolicy()

Methods

on_exception

Is executed if an exception is raised while executing the next policy.

This method is executed inside the exception handler.

on_request

Is executed before sending the request from next policy.

on_response

Is executed after the request comes back from the policy.

on_exception

Is executed if an exception is raised while executing the next policy.

This method is executed inside the exception handler.

on_exception(request: PipelineRequest[HTTPRequestType]) -> None

Parameters

Name Description
request
Required

The Pipeline request object

on_request

Is executed before sending the request from next policy.

on_request(request: PipelineRequest[HTTPRequestType]) -> None | Awaitable[None]

Parameters

Name Description
request
Required

Request to be modified before sent from next policy.

on_response

Is executed after the request comes back from the policy.

on_response(request: PipelineRequest[HTTPRequestType], response: PipelineResponse[HTTPRequestType, HTTPResponseType]) -> None | Awaitable[None]

Parameters

Name Description
request
Required

Request to be modified after returning from the policy.

response
Required

Pipeline response object