Metadata-Version: 2.4
Name: puragram
Version: 1.0.0
Summary: Fast, dependency-light Telegram Bot API framework built on urllib3
Author-email: Maxim Zhovner <zovnercukmaksim197@gmail.com>
License: MIT
Keywords: telegram,bot,api,urllib3,framework
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: urllib3>=2.0
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Dynamic: license-file

# puragram

A fast, dependency-light Telegram Bot API framework for Python.
Built on urllib3 — no aiohttp, no requests, no httpx.

## Install

```bash
pip install puragram
```

## Quick start

```python
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

```python
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.
