Telegram MTProto API Framework for Python
Documentation
•
Releases
•
Channel
•
Support
DzGram
Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots
from pyrogram import Client, filters
app = Client("my_account")
@app.on_message(filters.private)
async def hello(client, message):
await message.reply("Hello from Pyrogram!")
app.run()
DzGram is a modern, elegant and asynchronous MTProto API framework. It enables you to easily interact with the main Telegram API through a user account (custom client) or a bot identity (bot API alternative) using Python.
Key Features
- Ready: Install DzGram with pip and start building your applications right away.
- Easy: Makes the Telegram API simple and intuitive, while still allowing advanced usages.
- Elegant: Low-level details are abstracted and re-presented in a more convenient way.
- Fast: Boosted up by WarpCrypto, a high-performance cryptography library written in Rust.
- Type-hinted: Types and methods are all type-hinted, enabling excellent editor support.
- Async: Fully asynchronous (also usable synchronously if wanted, for convenience).
- Powerful: Full access to Telegram's API to execute any official client action and more.
Installing
pip3 install dzgram
Transfer performance
Uploads use reusable, size-capped connection pools and burst dispatch. User and
bot transfers adapt their request rate on successful parts and Telegram flood
waits; Premium transfers skip client-side pacing while still respecting flood
waits. Progress callbacks are called when the completed byte count changes.
Bot and Premium downloads prefetch the first parallel wave while the initial chunk is
in flight. Transfer connections use Telegram's advertised media endpoints, and
TCP receive buffers assemble fragmented packets without repeatedly copying them.
Bot uploads reuse the download connection pool. Bot pacing starts at 32 upload
parts/second and 16 download chunks/second, increases on success, and applies
Telegram flood cooldowns across the transfer's workers. Override the starting
rates with DZGRAM_BOT_UPLOAD_RATE and DZGRAM_BOT_DL_RATE.
Connection counts can be tuned before starting your client:
| Account | Upload pool | Download pool | Download workers per connection |
|---|---|---|---|
| User | DZGRAM_UPLOAD_POOL (12) |
DZGRAM_DL_POOL (5) |
DZGRAM_DL_WORKERS (3) |
| Bot | DZGRAM_BOT_UPLOAD_POOL (8) |
DZGRAM_BOT_DL_POOL (5) |
DZGRAM_BOT_DL_WORKERS (3) |
| Premium | DZGRAM_PREMIUM_UPLOAD_POOL (14) |
DZGRAM_PREMIUM_DL_POOL (6) |
DZGRAM_PREMIUM_DL_WORKERS (4) |
Resources
- Check out the docs (source in
docs/) to learn more about DzGram, get started right away and discover more in-depth material for building your client applications. Build them locally withcd docs && make html. - Join the official channel and stay tuned for news, updates and announcements.
- Get help and discuss in the support group.
Metadata
Release files for dzgram 2.3.35
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dzgram-2.3.35.tar.gz | 597.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dzgram-2.3.35-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.4 MB
Release files / dzgram-2.3.35.tar.gz
| Download URL | dzgram-2.3.35.tar.gz |
|---|---|
| Size | 597.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45974cf52aed00b7e9dbd7c5ccc9fe0c223a5eefd1851741e59579dcb6735a7e
|
|
BLAKE2b-256 checksum How to use checksums |
58acc9dc7f49084a6f18d6a02da02257c39ef04e7a0548961aa18c751ca8571d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / dzgram-2.3.35-py3-none-any.whl
| Download URL | dzgram-2.3.35-py3-none-any.whl |
|---|---|
| Size | 5.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6492c3ce61a78b4db5dc87c7e0cf1fdb058327abb062bb9d9daea2accefa616
|
|
BLAKE2b-256 checksum How to use checksums |
a5ce3e36b7264f3c05bad5f72b2d7bef1a0638b7e1ed92d40e3207a43f2928e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|