s3minimal - The Minimalist S3 Library
s3minimal is a Python library designed to simplify interactions with Amazon S3 using the aiobotocore and botocore libraries. It provides asynchronous and synchronous classes for various S3 operations.
Installation
pip install s3minimal
Usage
Initialization
Initialize the S3 class with your AWS credentials, endpoint URL, and region name.
from s3minimal import S3
s3 = S3(
endpoint_url="https://s3.amazonaws.com",
region_name="us-east-1",
aws_access_key_id="your_access_key",
aws_secret_access_key="your_secret_key",
)
# or if you have environment variables set for your AWS credentials
s3 = S3()
For synchronous operations, you can use the S3Sync class in a similar manner, and all asynchronous methods described below can be called without await.
Set Bucket
s3.set_bucket("your_bucket_name")
Download File
file = await s3.download("path/to/your/file")
Upload File
with open("path/to/your/local/file", "rb") as f:
file_obj = io.BytesIO(f.read())
await s3.upload("path/to/your/s3/file", file_obj)
Move File
await s3.move("path/to/source/file", "path/to/destination/file")
Generate Presigned URL
url = await s3.generate_presigned_url("path/to/your/file")
Create Bucket
Create a new S3 bucket:
await s3.create_bucket("new_bucket_name")
To set CORS configurations during bucket creation, pass the set_cors parameter as True and provide the cors_configuration:
cors_configuration = {
"CORSRules": [
{
"AllowedHeaders": ["Access-Control-Allow-Origin", "*"],
"AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD"],
"AllowedOrigins": ["*"],
"MaxAgeSeconds": 60,
}
]
}
await s3.create_bucket("new_bucket_name", set_cors=True, cors_configuration=cors_configuration)
List Files
files = await s3.list_files("path/in/your/bucket")
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Metadata
Release files for s3minimal 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| s3minimal-0.4.tar.gz | 5.0 kB | Without provenance | Details for s3minimal-0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| s3minimal-0.4-py3-none-any.whl | Python 3 | none | any | Details for s3minimal-0.4-py3-none-any.whl |
Total release size: 10.7 kB
Release files / s3minimal-0.4.tar.gz
| Download URL | s3minimal-0.4.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
177db93ffb26d2f50edcdd47a20684885fed2657fa9120e76212e6521162461e
|
|
BLAKE2b-256 checksum How to use checksums |
ae572c11aa9da517a269cb453d86d86cf6073edb4252bf75271df3c656c21355
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.10.12 Darwin/23.1.0
|
Release files / s3minimal-0.4-py3-none-any.whl
| Download URL | s3minimal-0.4-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2faf7ba37aaadeb0b5c3eb39502f10a91f80859c8d55abd58af0270494dcfd44
|
|
BLAKE2b-256 checksum How to use checksums |
e48d4bbf751b23e087081404dbcc38023f13672ef5e1ba140ec35076869641d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.10.12 Darwin/23.1.0
|
Security for s3minimal 0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.