Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentele-1.15.1.tar.gz (74.0 kB view details)

Uploaded Source

Built Distribution

opentele-1.15.1-py3-none-any.whl (81.3 kB view details)

Uploaded Python 3

File details

Details for the file opentele-1.15.1.tar.gz.

File metadata

  • Download URL: opentele-1.15.1.tar.gz
  • Upload date:
  • Size: 74.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for opentele-1.15.1.tar.gz
Algorithm Hash digest
SHA256 366b258b6b02c33c24d47d007cb8f188b9b2a13c713585c01cb4174966fb953d
MD5 be3106e00e5b3306e5ba5a407cce5942
BLAKE2b-256 0868b0e585e86700be62c268c09bc8f0281915ad01071d32c1e6704724e2b9d8

See more details on using hashes here.

File details

Details for the file opentele-1.15.1-py3-none-any.whl.

File metadata

  • Download URL: opentele-1.15.1-py3-none-any.whl
  • Upload date:
  • Size: 81.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for opentele-1.15.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c7e783937ca85d7bf4065435693c8a053fb16f69a87b645d27fd299289cd8499
MD5 8c94abb503304051324ab8d139c2b1b8
BLAKE2b-256 0ab33a1a513bea0d95aada408d3dfde2929a9d2eca8b7b02cb1d4e173862e020

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page