Client

The entrypoint to the library is the Client class. To interact with the Storage API, you make an instance of this class.

storage3.create_client(url: str, headers: dict[str, str], *, is_async: Literal[True]) AsyncStorageClient
storage3.create_client(url: str, headers: dict[str, str], *, is_async: Literal[False]) SyncStorageClient
class storage3.AsyncStorageClient(url: str, headers: dict[str, str], timeout: int = 20)

Manage storage buckets and files.

async create_bucket(id: str, name: str | None = None, options: CreateOrUpdateBucketOptions | None = None) dict[str, str]

Creates a new storage bucket.

Parameters:
  • id – A unique identifier for the bucket you are creating.

  • name – A name for the bucket you are creating. If not passed, the id is used as the name as well.

  • options – Extra options to send while creating the bucket. Valid options are public, file_size_limit and allowed_mime_types.

async delete_bucket(id: str) dict[str, str]

Deletes an existing bucket. Note that you cannot delete buckets with existing objects inside. You must first empty() the bucket.

Parameters:

id – The unique identifier of the bucket you would like to delete.

async empty_bucket(id: str) dict[str, str]

Removes all objects inside a single bucket.

Parameters:

id – The unique identifier of the bucket you would like to empty.

from_(id: str) AsyncBucketProxy

Run a storage file operation.

Parameters:

id – The unique identifier of the bucket

async get_bucket(id: str) AsyncBucket

Retrieves the details of an existing storage bucket.

Parameters:

id – The unique identifier of the bucket you would like to retrieve.

async list_buckets() list[AsyncBucket]

Retrieves the details of all storage buckets within an existing product.

async update_bucket(id: str, options: CreateOrUpdateBucketOptions) dict[str, str]

Update a storage bucket.

Parameters:
  • id – The unique identifier of the bucket you would like to update.

  • options – The properties you want to update. Valid options are public, file_size_limit and allowed_mime_types.