aiostorage.providers package¶
Submodules¶
Full documentation of each module in this package (aimed at library developers):
aiostorage.providers.backblaze module¶
This module contains the Backblaze class.
-
class
aiostorage.providers.backblaze.
Backblaze
(**kwargs)¶ Bases:
object
Asynchronous wrapper around the Backblaze B2 Cloud Storage API.
-
API_DOMAIN
= 'https://api.backblazeb2.com'¶
-
API_ENDPOINTS
= {'authorize_account': 'b2_authorize_account/', 'get_upload_url': 'b2_get_upload_url/', 'list_buckets': 'b2_list_buckets/'}¶
-
API_NAME
= 'b2api/'¶
-
API_VERSION
= 'v1/'¶
-
__init__
(**kwargs)¶ Set credentials.
Parameters: **kwargs – API credentials, see below. - : Keyword arguments
- account_id (
str
) – Account id. - app_key (
str
) – Application key.
- account_id (
-
_get_api_url
(action)¶ Generate API endpoint URL.
Parameters: action (str) – API action to get URL for. Returns: API endpoint URL. Return type: str
-
_get_upload_url
(bucket_id)¶ async Retrieve URL used to upload a file.
Parameters: bucket_id (str) – Bucket to upload file to. Raises: ClientResponseError – If HTTP status code >= 400. Returns: JSON API response containing upload URL. Return type: dict
async Perform API authorization and update authorization attributes.
Raises: ClientResponseError – If HTTP status code >= 400. Returns: JSON API response containing authorization details. Return type: dict
-
upload_file
(bucket_id, file_to_upload, content_type)¶ async Upload file.
Parameters: - bucket_id (str) – Bucket to upload file to.
- file_to_upload (str) – Path of file to upload.
- content_type (str) – Content (MIME) type of file to upload.
Returns: JSON API response containing confirmation of file upload.
Return type: dict
-
aiostorage.providers.exceptions module¶
This module contains exceptions for object storage provider API errors.
-
exception
aiostorage.providers.exceptions.
ProviderAuthorizationError
¶ Bases:
aiostorage.providers.exceptions.ProviderError
Unable to authorize.
-
exception
aiostorage.providers.exceptions.
ProviderError
¶ Bases:
Exception
Base exception class.
-
exception
aiostorage.providers.exceptions.
ProviderFileUploadError
¶ Bases:
aiostorage.providers.exceptions.ProviderError
Unable to upload file.
-
exception
aiostorage.providers.exceptions.
ProviderGetUploadUrlError
¶ Bases:
aiostorage.providers.exceptions.ProviderError
Unable to get file upload URL.
Module contents¶
Package summary (aimed at library developers):
This package contains asynchronous wrappers for the following object storage provider APIs
- Backblaze B2 Cloud Storage
It is for internal usage only.