Skip to main content

pyjetra

Python toolkit for Jetra Messenger, with two independent clients:

  • pyjetra.botapi: Bot API wrapper (sync and async), with FSM, filters, inline keyboards and webhooks.
  • pyjetra.userapi: User account client (MTProto-style protocol, SRP login, 2FA).

Install

pip install pyjetra[bot]     # Bot API only
pip install pyjetra[user]    # User account only
pip install pyjetra[all]     # both

Requires Python 3.10 or newer.

Bot API quick start

from pyjetra.botapi import JetraBot, CommandFilter

bot = JetraBot("YOUR_BOT_TOKEN")

@bot.on_message(filters=[CommandFilter("start")])
def start(msg):
    msg.reply("Hello from pyjetra")

bot.poll()

User account quick start

from pyjetra.userapi import JetraClient

Session and local database files are stored in ~/.pyjetra by default. Change the location with the PYJETRA_DATA_DIR environment variable. Session files are never part of the package.

Examples

The examples/ folder contains runnable scripts that teach pyjetra step by step.

Folder Topic
examples/01_bot_basics/ Echo bot, Persian+English commands
examples/02_bot_intermediate/ FSM, inline buttons, webhook
examples/03_bot_advanced/ Media upload, chat admin, error handling
examples/04_user_basics/ Login, send message, listen
examples/05_user_intermediate/ Dialogs, participants, media
examples/06_user_advanced/ Channel admin, invites, privacy, 2FA, stories
examples/99_recipes/ Autoresponder, group guard, scheduled sender

See examples/README.md for run instructions and docs/CONCEPTS.md for the underlying concepts (TL, access_hash, FSM, session).

Quick run:

export JETRA_BOT_TOKEN="your_bot_token"
python examples/01_bot_basics/01_echo_bot.py

Helper scripts

scripts/ contains login helpers and one-off fixers:

  • scripts/login.py - Interactive login (phone, code, 2FA).
  • scripts/jetra_login.py - Alternative login flow.
  • scripts/jetra_fix_uid.py - Repair an old session by reattaching user_id.

Run with python scripts/login.py from the project root.

Banner

The banner is not printed on import. Call pyjetra.botapi.banner.print_banner() if you want it.

Disclaimer

pyjetra is not an official Jetra product. You are responsible for your account and for complying with Jetra's terms.

License

MIT. Author: Ali VEX.

Metadata

Release files for pyjetra 2.0.9

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

Built distribution (wheel)

Table of built distributions (wheels) for pyjetra 2.0.9
File Interpreter ABI Platform Actions
pyjetra-2.0.9-py3-none-any.whl Python 3 none any Details for pyjetra-2.0.9-py3-none-any.whl

Release files / pyjetra-2.0.9-py3-none-any.whl

Download URL pyjetra-2.0.9-py3-none-any.whl
Size 129.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac0ce8da8ea7d4377453d0483ed3ce825e87ab95a9eaf651038f7b8bae9d6638
BLAKE2b-256 checksum
How to use checksums
87725f66d71aa5cb0e60ba034f280d263087a1ff1e48e2a7d8cf972837133a1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Security for pyjetra 2.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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