Skip to main content

📦 TG Storage Cluster

Python FastAPI License Developer

A lightweight, high-performance file storage API that transforms Telegram into an infinite, scalable backend.


🚀 Installation

Install the package directly via pip:

pip install tgstorage-cluster

🛠️ Setup & Usage

1. Configuration

The package looks for a .env file and a tokens.txt file in your current working directory.

  1. Create a .env file:
API_ID=your_id
API_HASH=your_hash
CHANNEL_ID=your_channel_id
ADMIN_API_KEY=your_secret_key
BASE_URL=http://localhost
  1. Create a tokens.txt file and add your bot tokens (one per line).

2. Run the Server

You can start the storage server using the built-in CLI command:

tgstorage

The server will start on http://localhost:8082.

3. Generate API Keys

Manage your client keys using the management CLI:

tgstorage-key --owner "MyWebApp"

📦 Integration in your Python Code

You can use the cluster logic directly in your own projects without running the FastAPI server:

import asyncio
from tgstorage.bot import cluster

async def upload_something():
    # It will automatically load config from your current directory's .env
    bot = await cluster.get_healthy_bot()
    with open("image.png", "rb") as f:
        msg = await bot.send_document(
            chat_id=-100123456789, 
            document=f, 
            filename="image.png"
        )
    print(f"File uploaded! Message ID: {msg.message_id}")

asyncio.run(upload_something())

📜 License

MIT

Metadata

Release files for tgstorage-cluster 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tgstorage-cluster 1.0.2
File Size Uploaded
tgstorage_cluster-1.0.2.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tgstorage-cluster 1.0.2
File Interpreter ABI Platform
tgstorage_cluster-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 30.9 kB

Release files / tgstorage_cluster-1.0.2.tar.gz

Download URL tgstorage_cluster-1.0.2.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
810dd0142f712782b6ef448e4cd7af35224c37acc1b485750e5a7d1df246043e
BLAKE2b-256 checksum
How to use checksums
4c3ff17d4b7e5809115fb07052aadf2b3947f6f7bd3012298387cbb31484315a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / tgstorage_cluster-1.0.2-py3-none-any.whl

Download URL tgstorage_cluster-1.0.2-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff34d32035d9a371abaf1d414c18e1eb7d615361305e504caa4ab7aa6e67dfc1
BLAKE2b-256 checksum
How to use checksums
7f30772e7f41dcdf92a5d961956348c79a4e6849a76e8b27e0b402a03314b2a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page