Metadata-Version: 2.4
Name: nexium-storage
Version: 0.1.1
Summary: Official Python SDK for NEXIUM Storage
Author-email: NEXIUM <ai.nexium@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://nexiumai.io
Project-URL: Documentation, https://console.nexiumai.io/docs
Keywords: nexium,storage,s3,r2,file-upload,cloud
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Provides-Extra: requests
Requires-Dist: requests>=2.28; extra == "requests"

# nexium-storage

Official Python SDK for [NEXIUM Storage](https://console.nexiumai.io/docs) — upload, serve and manage files via a simple API.

## Install

```bash
pip install nexium-storage

# For file upload support:
pip install "nexium-storage[requests]"
```

## Quick start

```python
import os
from nexium_storage import NexiumStorage

storage = NexiumStorage(api_key=os.getenv("NEXIUM_API_KEY"))

# Upload
with open("photo.jpg", "rb") as f:
    file = storage.upload(bucket_id, f, "photo.jpg", "image/jpeg")
print(file.url)

# List
result = storage.list(bucket_id, search="photo")
for f in result.files:
    print(f.filename, f.size_bytes)

# Download URL
url = storage.download(file.id)

# Rename
storage.rename(file.id, "new-name.jpg")

# Delete
storage.delete(file.id)
```

## Webhook verification

```python
from nexium_storage import NexiumStorage, NexiumError

# Flask example
@app.route("/webhook", methods=["POST"])
def webhook():
    try:
        payload = NexiumStorage.verify_webhook(
            request.get_data(),
            request.headers.get("X-Nexium-Signature"),
            os.getenv("NEXIUM_WEBHOOK_SECRET"),
        )
        print(payload["event"], payload["data"])
        return "", 200
    except NexiumError:
        return "", 401
```

## License

MIT
