puragram
A fast, dependency-light Telegram Bot API framework for Python. Built on urllib3 — no aiohttp, no requests, no httpx.
Install
pip install puragram
Quick start
from puragram import Bot
bot = Bot("YOUR_TOKEN", parse_mode="HTML")
@bot.message_handler(commands=["start"])
def start(msg):
bot.send_message(msg.chat.id, f"Hi, <b>{msg.from_user.first_name}</b>!")
@bot.message_handler(content_types=["text"])
def echo(msg):
bot.send_message(msg.chat.id, f"You said: <b>{msg.text}</b>")
if __name__ == "__main__":
bot.run_polling()
Features
- Fast: direct urllib3 pool, JSON bodies, keep-alive
- Built-in FSM: State, StatesGroup, MemoryStorage, FileStorage, SQLiteStorage
- Middleware: logging, throttling, timing
- Filters: Command, Text, Regexp, ContentTypes, ChatType, ChatId, UserId, CallbackData, Func
- Webhook server on stdlib http.server
- Secure: path traversal guard, size limits, ReDoS filter, webhook secret, token redaction, dedup
- Zero dependencies except urllib3
FSM example
from puragram import Bot, State, StatesGroup
bot = Bot("YOUR_TOKEN")
class Form(StatesGroup):
name = State()
@bot.message_handler(commands=["start"])
def start(msg, data):
data["state"].set_state(Form.name)
bot.send_message(msg.chat.id, "Your name?")
@bot.message_handler(state=Form.name)
def on_name(msg, data):
data["state"].update_data(name=msg.text)
data["state"].clear()
bot.send_message(msg.chat.id, f"Hi, {msg.text}!")
bot.run_polling()
License
MIT — see LICENSE.
Release files for puragram 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| puragram-1.0.0.tar.gz | 21.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| puragram-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.8 kB
Release files / puragram-1.0.0.tar.gz
| Download URL | puragram-1.0.0.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fdb8786f8e75877408b4f65f53a900b13e93f8b9e1cfa21a8898a8b606346133
|
|
BLAKE2b-256 checksum How to use checksums |
deb24f8b55343b46361be683c340b20342138dc618e104fa10b7250a9547bd8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / puragram-1.0.0-py3-none-any.whl
| Download URL | puragram-1.0.0-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1ecfb0541e6cf251ca1ed87b9a1ea75301da45042b9b4a2d7c92d3f1c435bca
|
|
BLAKE2b-256 checksum How to use checksums |
981a935f522a4080c2202bf38df69f296e3e93b57aff51c95c4f3c2b3969a8a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|