Minimal async s3 implementation.
Project description
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")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
s3lite-0.1.12.tar.gz
(8.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
s3lite-0.1.12-py3-none-any.whl
(10.6 kB
view details)
File details
Details for the file s3lite-0.1.12.tar.gz.
File metadata
- Download URL: s3lite-0.1.12.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.14.3 Linux/6.19.6-200.fc43.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2566e50b454598c61e0432b7c57df74b5ab1b72649a80db766f84459aeb51dde
|
|
| MD5 |
a64498bfcd812b1607db3e3efdee0c40
|
|
| BLAKE2b-256 |
481a280d3d260665418408cdefe5a1728979441a6a6478ac5a44d40b2316d6f2
|
File details
Details for the file s3lite-0.1.12-py3-none-any.whl.
File metadata
- Download URL: s3lite-0.1.12-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.14.3 Linux/6.19.6-200.fc43.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f85d9b3e7c17ec0116ec68cec0b2d1f1c7b6d439556f05a48563781f9b1a59bb
|
|
| MD5 |
690faa9de42bec05f31b479792e8dc2a
|
|
| BLAKE2b-256 |
d7fe3a37e875c3478f6ae394c77522868a093496298ce694f3c573849aebe629
|