Metadata-Version: 2.4
Name: flaxon-s3
Version: 0.1.0
Summary: Amazon S3-compatible object storage integration for Flaxon
Author: Aldane Hutchinson
License: MIT
Project-URL: Repository, https://github.com/aldanedev-create/flaxon-s3
Project-URL: Issues, https://github.com/aldanedev-create/flaxon-s3/issues
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: AsyncIO
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: boto3>=1.34
Requires-Dist: flaxon>=0.2.0
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Dynamic: license-file

# Flaxon S3

`flaxon-s3` gives Flaxon applications access to Amazon S3-compatible object
storage, including services that expose the S3 API through a custom endpoint.
The configured storage service is available at `app.state.s3`.

## Install

```bash
pip install flaxon-s3
```

## Use

```python
import os

from flaxon import Flaxon
from flaxon_s3 import S3Plugin

app = Flaxon("uploads")
await app.plugins.load_plugin(
    S3Plugin(
        bucket="uploads",
        region_name="us-east-1",
        endpoint_url=os.environ.get("S3_ENDPOINT_URL"),
    )
)


@app.post("/files")
async def upload_file(request):
    body = await request.body()
    app.state.s3.upload_bytes("incoming/report.pdf", body, content_type="application/pdf")
    return {"key": "incoming/report.pdf"}
```

Provide credentials through the standard AWS credential provider chain or your
deployment's secret manager. The plugin deliberately does not make buckets
public or infer authorization. Keep object keys server-controlled, enforce
content limits before reading uploads, and scope IAM permissions to the needed
bucket and actions.
