A Python 3.13+ compatible fork of opentele - Telegram API Library for converting between tdata and telethon sessions.
Project description
opentele-py313
Python 3.13+ Compatible Fork
This is a Python 3.13+ compatible fork of the original opentele library by thedemons.
What's Changed?
- Python 3.13 Compatibility: Fixed compatibility issues with Python 3.13 by handling new class attributes (
__firstlineno__and__static_attributes__) in theextend_classdecorator. - All original functionality remains intact.
Original Project
This fork is based on opentele v1.15.1. All credit for the original library goes to thedemons.
Original repository: https://github.com/thedemons/opentele
Features
- Convert Telegram Desktop tdata sessions to telethon sessions and vice versa.
- Use telethon with official APIs to avoid bot detection.
- Randomize device info using real data that recognized by Telegram server.
Dependencies
- telethon - Widely used Telegram's API library for Python.
- tgcrypto - AES-256-IGE encryption to works with
tdata. - pyQt5 - Used by Telegram Desktop to streams data from files.
Installation
For Python 3.13+
Install this fork from PyPI:
pip install --upgrade opentele-py313
For Python 3.12 and below
Use the original library:
pip install --upgrade opentele
First Run
Load TDesktop from tdata folder and convert it to telethon, with a custom API:
from opentele.td import TDesktop
from opentele.tl import TelegramClient
from opentele.api import API, CreateNewSession, UseCurrentSession
import asyncio
async def main():
# Load TDesktop client from tdata folder
tdataFolder = r"C:\Users\<username>\AppData\Roaming\Telegram Desktop\tdata"
tdesk = TDesktop(tdataFolder)
# Using official iOS API with randomly generated device info
# print(api) to see more
api = API.TelegramIOS.Generate()
# Convert TDesktop session to telethon client
# CreateNewSession flag will use the current existing session to
# authorize the new client by `Login via QR code`.
client = await tdesk.ToTelethon("newSession.session", CreateNewSession, api)
# Although Telegram Desktop doesn't let you authorize other
# sessions via QR Code (or it doesn't have that feature),
# it is still available across all platforms (APIs).
# Connect and print all logged in devices
await client.connect()
await client.PrintSessions()
asyncio.run(main())
Authorization
opentele offers the ability to use official APIs, which are used by official apps. You can check that out here.
According to Telegram TOS: all accounts that sign up or log in using unofficial Telegram API clients are automatically put under observation to avoid violations of the Terms of Service.
It also uses the lang_pack parameter, of which telethon can't use because it's for official apps only.
Therefore, there are no differences between using opentele and official apps, the server can't tell you apart.
Incoming Features
- Writing data to tdata for converting telethon sessions to tdesktop.
- Random device information for initConnection to avoid spam-detection.
- Add support for pyrogram.
- Develop opentele-tui using textual for non-experience user.
Examples
The best way to learn anything is by looking at the examples. Am I right?
- Example on readthedocs
- Example on github
Documentation 
- Read documentation on readthedocs
- Read documentation on github
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opentele_py313-1.15.2.tar.gz.
File metadata
- Download URL: opentele_py313-1.15.2.tar.gz
- Upload date:
- Size: 74.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f491b74cbe211614f2de958c9ad9b466c61ebd417097b5a89acb647280fa205a
|
|
| MD5 |
86eaa2812555f53eba2f469b9cfeabf2
|
|
| BLAKE2b-256 |
50134ce0e97404249baac222d68a34398f4988909d95d100e8ee4e793a023bb5
|
File details
Details for the file opentele_py313-1.15.2-py3-none-any.whl.
File metadata
- Download URL: opentele_py313-1.15.2-py3-none-any.whl
- Upload date:
- Size: 81.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1d0df6f4055d054148abc3272a30a80959aca51f1d1b9efd31facb1d1b54e08
|
|
| MD5 |
a14203fd0d09b41667e7d1a38f55b98e
|
|
| BLAKE2b-256 |
1244181d09fbb6b31db4c366e268818c3e019f7d2b6d2df3cb497dbd69a8ffdb
|