cloud-storage-clients
cloud-storage-clients is a Python library for having an unique interface over different cloud storage providers.
It can be used to connect a python client to providers.
This package is maintained by Picsellia.
This has been conceived for you to override classes. For example, override VaultRepository if you retrieve credentials in another way. You can create or override factories of client to add some additional parameters.
Installation
Add it to your poetry environment
poetry add cloud-storage-clients
Or use the package manager pip to install it.
pip install cloud-storage-clients
Usage
Basic client usage to retrieve a specific object name from an S3 bucket
from cloud_storage_clients.connector import Connector
from cloud_storage_clients.s3.client import S3Client
connector = Connector(client_type="s3", bucket="my-bucket")
client = S3Client(connector, {"access_key_id": "access-key", "secret_access_key": "secret-access-key" })
with open("/path/object-name.jpg", "wb") as file:
response = client.get("object-name.jpg")
file.write(response.content)
Pool Instanciation
from cloud_storage_clients.connector import Connector
from cloud_storage_clients.s3.factory import S3ClientFactory
from cloud_storage_clients.repositories.vault_adapter import DefaultVaultAdapter, TokenCredentials
from cloud_storage_clients.repositories.vault import VaultCredentialRepository
from cloud_storage_clients.pool import ClientPool
# Login to your Vault by creating a VaultAdapter and its repository
vault_adapter = DefaultVaultAdapter(
url="http://localhost:7200",
credentials=TokenCredentials(token="vault_token", unseal_key="unseal_key")
)
repository = VaultCredentialRepository(adapter=vault_adapter)
# Instantiate a ClientPool and add an S3ClientFactory for minio client_type
pool = ClientPool(default_repository=repository)
pool.register_factory("minio", factory=S3ClientFactory())
# Create a connector object
connector = Connector(client_type="minio", bucket="my-bucket")
# Use pool to instantiate a client that have its credentials in Vault
client = pool.get_client(connector)
# Generate a presigned url that an user without access to your bucket can download
presigned_url = client.get_download_url("object-name", 3600).url
Metadata
Release files for cloud-storage-clients 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cloud_storage_clients-0.4.0.tar.gz | 12.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cloud_storage_clients-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.7 kB
Release files / cloud_storage_clients-0.4.0.tar.gz
| Download URL | cloud_storage_clients-0.4.0.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7013f7576965dec1abad93175a70652b0029934851096128272e0de5533d596e
|
|
BLAKE2b-256 checksum How to use checksums |
789aaf8d0184d4d10b69c40914aa12eb9a77cd5e5ad2be06fe968d90fa7aa0e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.29 {"installer":{"name":"uv","version":"0.9.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / cloud_storage_clients-0.4.0-py3-none-any.whl
| Download URL | cloud_storage_clients-0.4.0-py3-none-any.whl |
|---|---|
| Size | 21.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
988551b8e0e3f55653e21d17015a32707c53b173b5d45bca7ff4a21b17d40dc4
|
|
BLAKE2b-256 checksum How to use checksums |
84836963dbc3129b8e320ef10c7381d4dbc9f2e4766171ff27d38d9eb8ccfea0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.29 {"installer":{"name":"uv","version":"0.9.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|