Skip to Content

Telegram session tooling for Python

Convert tdata
and Telethon sessions.

opentele2 provides Python APIs for Telegram Desktop session conversion, Telethon integration, official API templates, and device fingerprint generation.
Bidirectional conversion Official API flows Telethon-friendly

Features

Start in the right place

Quick start

Install the package:

pip install --upgrade opentele2

Convert Telegram Desktop tdata to a Telethon session:

import asyncio from opentele2.api import API, CreateNewSession from opentele2.td import TDesktop async def main() -> None: tdesk = TDesktop(r"C:\Users\<username>\AppData\Roaming\Telegram Desktop\tdata") api = API.TelegramIOS.Generate() client = await tdesk.ToTelethon("new.session", CreateNewSession, api) await client.connect() await client.PrintSessions() asyncio.run(main())

See the conversion example for the complete workflow.


A New Era for opentele

opentele2 is the rebirth of the original opentele project. The library is now actively maintained and under continued development. We are committed to keeping it up-to-date with the latest versions of Telegram Desktop and Telethon, fixing bugs, and adding new features.

Key Enhancements

  • PyQt5 Removed: The PyQt5 library has been completely removed. Its functionality has been reimplemented in pure Python to eliminate overhead and avoid installing unnecessary heavy dependencies.
  • New Fingerprints: Some improvements of device information generation. The library now uses a new device database.
Last updated on