ChatStorage3
A boto3-inspired object storage library powered by chat platforms.
Store and retrieve files using platforms like Bale and Telegram with a simple object storage API.
ChatStorage3
ChatStorage3 is a lightweight object storage library inspired by boto3.
Instead of relying on traditional object storage services, ChatStorage3 uses chat platforms as storage backends and provides a simple API for uploading, downloading, and managing files.
It is designed for applications that need lightweight storage for:
- Product images
- User uploads
- Documents
- Small videos
- Media assets
without managing additional storage infrastructure.
Features
- Boto3-inspired object storage API
- Upload and download files
- Upload from file objects
- Download to file objects
- Object metadata management
- Persistent object indexing using SQLite
- Provider-based architecture
- Multiple storage backend support
- Support for Bale and Telegram
- Designed for Django and FastAPI integrations
How It Works
ChatStorage3 separates storage logic from storage providers.
Application
|
v
ChatStorage3 Client
|
+----------------+
| |
v v
Object Index Provider
(SQLite) (Bale/Telegram)
|
v
Chat Platform
Files are stored on the chat platform.
ChatStorage3 maintains the mapping between:
Bucket + Key
|
v
File ID
|
v
Stored File
The index layer allows ChatStorage3 to provide a storage API similar to object storage systems.
Installation
pip install chatstorage3
Quick Start
import chatstorage3
storage = chatstorage3.client(
"s3",
provider="bale",
token="YOUR_BOT_TOKEN",
chat_id="YOUR_CHAT_ID",
)
Upload File
storage.upload_file(
"image.jpg",
"products",
"image.jpg",
)
Download File
storage.download_file(
"products",
"image.jpg",
"downloaded.jpg",
)
Upload Object
Upload raw bytes directly:
storage.put_object(
Bucket="products",
Key="hello.txt",
Body=b"Hello ChatStorage3!",
ContentType="text/plain",
)
Get Object
response = storage.get_object(
Bucket="products",
Key="hello.txt",
)
content = response["Body"].read()
print(content)
Output:
b'Hello ChatStorage3!'
File Objects
ChatStorage3 supports file-like objects:
from io import BytesIO
file = BytesIO(
b"Hello from file object"
)
storage.upload_fileobj(
file,
"products",
"file.txt",
)
Download:
output = BytesIO()
storage.download_fileobj(
"products",
"file.txt",
output,
)
output.seek(0)
print(output.read())
Object Metadata
Retrieve object metadata:
metadata = storage.head_object(
Bucket="products",
Key="image.jpg",
)
Example:
{
"ContentLength": 1710092,
"ContentType": "image/png",
"FileName": "image.jpg",
"FileId": "..."
}
Providers
ChatStorage3 uses a provider architecture.
| Provider | Status |
|---|---|
| Bale | ✅ Available |
| Telegram | ✅ Available |
Adding a new provider only requires implementing the provider interface.
Architecture
chatstorage3
├── Client
│
├── Providers
│ ├── BaleProvider
│ └── TelegramProvider
│
└── Index
└── SQLiteIndex
Testing
Run tests:
pytest -v
Current tests cover:
- File upload lifecycle
- File download verification
- SQLite index operations
- Object lookup errors
- Multiple storage providers
Roadmap
- Bale provider
- Telegram provider
- SQLite object index
- boto3-inspired API
- File upload/download
- File object support
- Django Storage backend
- Async API
- Object deletion support
- More storage providers
License
MIT License
Author
Developed by MrMrProgrammer
For more projects and information:
- GitHub: https://github.com/MrMrProgrammer
- Website: https://mrmrprogrammer.ir
Links
Metadata
Release files for chatstorage3 0.0.3
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 |
|---|---|---|---|---|
| chatstorage3-0.0.3.tar.gz | 9.5 kB | Without provenance | Details for chatstorage3-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chatstorage3-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for chatstorage3-0.0.3-py3-none-any.whl |
Total release size: 19.3 kB
Release files / chatstorage3-0.0.3.tar.gz
| Download URL | chatstorage3-0.0.3.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de290d9b1e5f25b946660d97e4184ddb1fc26a353add21e79ed9d8691a1f8c28
|
|
BLAKE2b-256 checksum How to use checksums |
7b701541c48103e87d13dd48fbb7910ccfc666fdd208ce0ec29220ada73ef409
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.11
|
Release files / chatstorage3-0.0.3-py3-none-any.whl
| Download URL | chatstorage3-0.0.3-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
122d02be79581278ef437907f9aea8547f538970fafa0abda4da0e93c345c656
|
|
BLAKE2b-256 checksum How to use checksums |
f5cb6800b9ec3ffc9b6a8b9bc222f99c4046f59b7e92c00e63e3b61052329da6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.11
|
Security for chatstorage3 0.0.3
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.