This is the base class for service objects. Service objects are used to do all requests to Storage. This class cannot be instantiated directly.
- 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 (function(context)) – A function which determines whether to retry. Takes as a parameter a
RetryContextobject. Returns the number of seconds to wait before retrying the request, or None to indicate not to retry.
- location_mode (LocationMode) – 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 (requests.Session) – The session object to use for http requests.
- request_callback (function(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 (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 (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.
connection_params (obj) – The parameters to use to construct the client.
set_proxy(host, port, user=None, password=None)¶
Sets the proxy server host and port for the HTTP CONNECT Tunnelling.
- host (str) – Address of the proxy. Ex: ‘192.168.0.100’
- port (int) – Port of the proxy. Ex: 6000
- user (str) – User for proxy authorization.
- password (str) – Password for proxy authorization.