📦 TG Storage Cluster
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.
- Create a
.envfile:
API_ID=your_id
API_HASH=your_hash
CHANNEL_ID=your_channel_id
ADMIN_API_KEY=your_secret_key
BASE_URL=http://localhost
- Create a
tokens.txtfile 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)
| File | Size | Uploaded | |
|---|---|---|---|
| tgstorage_cluster-1.0.2.tar.gz | 14.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|