Skip to main content

ChatStorage3 Logo

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.

PyPI version Python versions


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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chatstorage3-0.0.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chatstorage3-0.0.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file chatstorage3-0.0.1.tar.gz.

File metadata

  • Download URL: chatstorage3-0.0.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.11

File hashes

Hashes for chatstorage3-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a8ac7d73a109c3d930ab25778da90ef8215ce2b295521374c335ceab44904409
MD5 2e30cb8642b921b264c0c768917472f2
BLAKE2b-256 d42bc3b607701794845b12f565d5618ba12358e4fe048fc61222e1aeba4260c8

See more details on using hashes here.

File details

Details for the file chatstorage3-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: chatstorage3-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.11

File hashes

Hashes for chatstorage3-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a6965664496da80db09dc7f049c27c43676b8726fee6436a01f164943bed3d9
MD5 8f31082237df4ae12cdad68b9df9a561
BLAKE2b-256 6de8ba27cd013dea93d67219489a681fbf94c98f9c278da9a347bf774835c10c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page