StorageClient Class

This is the base class for service objects. Service objects are used to do all requests to Storage. This class cannot be instantiated directly.

Inheritance
builtins.object
StorageClient

Constructor

StorageClient(connection_params)

Parameters

Name Description
connection_params
Required
<xref:obj>

The parameters to use to construct the client.

Variables

Name Description
account_name
str

The storage account name. This is used to authenticate requests signed with an account key and to construct the storage endpoint. It is required unless a connection string is given, or if a custom domain is used with anonymous authentication.

account_key
str

The storage account key. This is used for shared key authentication. If neither account key or sas token is specified, anonymous access will be used.

sas_token
str

A shared access signature token to use to authenticate requests instead of the account key. If account key and sas token are both specified, account key will be used to sign. If neither are specified, anonymous access will be used.

primary_endpoint
str

The endpoint to send storage requests to.

secondary_endpoint
str

The secondary endpoint to read storage data from. This will only be a valid endpoint if the storage account used is RA-GRS and thus allows reading from secondary.

retry
<xref:function>(<xref:context>)

A function which determines whether to retry. Takes as a parameter a RetryContext object. Returns the number of seconds to wait before retrying the request, or None to indicate not to retry.

location_mode

The host location to use to make requests. Defaults to LocationMode.PRIMARY. Note that this setting only applies to RA-GRS accounts as other account types do not allow reading from secondary. If the location_mode is set to LocationMode.SECONDARY, read requests will be sent to the secondary endpoint. Write requests will continue to be sent to primary.

protocol
str

The protocol to use for requests. Defaults to https.

request_session
<xref:requests.Session>

The session object to use for http requests.

request_callback
<xref:function>(<xref:request>)

A function called immediately before each request is sent. This function takes as a parameter the request object and returns nothing. It may be used to added custom headers or log request data.

response_callback
<xref:function>()

A function called immediately after each response is received. This function takes as a parameter the response object and returns nothing. It may be used to log response data.

retry_callback
<xref:function>()

A function called immediately after retry evaluation is performed. This function takes as a parameter the retry context object and returns nothing. It may be used to detect retries and log context information.

Methods

extract_date_and_request_id
set_proxy

Sets the proxy server host and port for the HTTP CONNECT Tunnelling.

extract_date_and_request_id

static extract_date_and_request_id(retry_context)

Parameters

Name Description
retry_context
Required

set_proxy

Sets the proxy server host and port for the HTTP CONNECT Tunnelling.

set_proxy(host, port, user=None, password=None)

Parameters

Name Description
host
Required
str

Address of the proxy. Ex: '192.168.0.100'

port
Required
int

Port of the proxy. Ex: 6000

user
str

User for proxy authorization.

Default value: None
password
str

Password for proxy authorization.

Default value: None

Attributes

protocol

request_session

socket_timeout