S3Lite
Minimal async s3 client implementation in python.
Installation
Requirements:
- Python 3.9+
pip install s3lite
Examples
List buckets
from s3lite import Client
client = Client("key-id", "secret-key", "https://s3-endpoint")
for bucket in await client.ls_buckets():
print(bucket.name)
Create new bucket
from s3lite import Client
client = Client("key-id", "secret-key", "https://s3-endpoint")
bucket = await client.create_bucket("new-bucket")
Upload object
from io import BytesIO
from s3lite import Client
client = Client("key-id", "secret-key", "https://s3-endpoint")
object_from_path = await client.upload_object("new-bucket", "test-image.jpg", "./local-image.png")
with open("document.txt", "rb") as f: # Make sure to open file in read-binary mode
object_from_file = await client.upload_object("new-bucket", "document.txt", f)
bytes_io = BytesIO(b"test file content")
object_from_bytesio = await client.upload_object("new-bucket", "test.txt", bytes_io)
Download object
from s3lite import Client
client = Client("key-id", "secret-key", "https://s3-endpoint")
saved_path = await client.download_object("new-bucket", "test-image.jpg", "./local-image.png")
bytes_io = await client.download_object("new-bucket", "document.txt", in_memory=True)
partial_bytes = await client.download_object("new-bucket", "test.txt", in_memory=True, offset=4, limit=6)
Generate presigned url
from s3lite import Client
client = Client("key-id", "secret-key", "https://s3-endpoint")
obj = await client.upload_object("new-bucket", "test-image.jpg", "./local-image.png")
presigned_url = obj.share() # Url will be valid for 1 day
presigned_url_1h = client.share("new-bucket", "test.txt", 3600) # Url will be valid for 1 hour
Delete object
from s3lite import Client
client = Client("key-id", "secret-key", "https://s3-endpoint")
saved_path = await client.delete_object("new-bucket", "test-image.jpg")
Metadata
Release files for s3lite 0.1.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| s3lite-0.1.12.tar.gz | 8.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| s3lite-0.1.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.3 kB
Release files / s3lite-0.1.12.tar.gz
| Download URL | s3lite-0.1.12.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2566e50b454598c61e0432b7c57df74b5ab1b72649a80db766f84459aeb51dde
|
|
BLAKE2b-256 checksum How to use checksums |
481a280d3d260665418408cdefe5a1728979441a6a6478ac5a44d40b2316d6f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.4 CPython/3.14.3 Linux/6.19.6-200.fc43.x86_64
|
Release files / s3lite-0.1.12-py3-none-any.whl
| Download URL | s3lite-0.1.12-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f85d9b3e7c17ec0116ec68cec0b2d1f1c7b6d439556f05a48563781f9b1a59bb
|
|
BLAKE2b-256 checksum How to use checksums |
d7fe3a37e875c3478f6ae394c77522868a093496298ce694f3c573849aebe629
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.4 CPython/3.14.3 Linux/6.19.6-200.fc43.x86_64
|