Skip to main content

opentele

logo

pypi version pypi status documentation workflow tests issues github last commit github commits pypi installs pypi license code format


A Python Telegram API Library for converting between tdata and telethon sessions, with built-in official Telegram APIs. Read the documentation.

Features

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

  • Install from PyPI:
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?

Documentation documentation

Metadata

Release files for opentele 1.15.1

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

Source distribution (sdist)

Source distribution for opentele 1.15.1
File Size Uploaded
opentele-1.15.1.tar.gz 74.0 kB Details

Built distribution (wheel)

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

Total release size: 155.3 kB

Release files / opentele-1.15.1.tar.gz

Download URL opentele-1.15.1.tar.gz
Size 74.0 kB
Tags Source
SHA-256 checksum
How to use checksums
366b258b6b02c33c24d47d007cb8f188b9b2a13c713585c01cb4174966fb953d
BLAKE2b-256 checksum
How to use checksums
0868b0e585e86700be62c268c09bc8f0281915ad01071d32c1e6704724e2b9d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.0

Release files / opentele-1.15.1-py3-none-any.whl

Download URL opentele-1.15.1-py3-none-any.whl
Size 81.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7e783937ca85d7bf4065435693c8a053fb16f69a87b645d27fd299289cd8499
BLAKE2b-256 checksum
How to use checksums
0ab33a1a513bea0d95aada408d3dfde2929a9d2eca8b7b02cb1d4e173862e020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.0

Release history Release notifications | RSS feed

This release

1.15.1 This release

2 release files

1.15

2 release files

1.14

2 release files

1.13

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

1 release file

1.0.6

1 release file

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

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