<!-- vim: syntax=Markdown -->
# opentele
<p align="center">
<img src="https://raw.githubusercontent.com/thedemons/opentele/main/opentele.png" alt="logo" width="180"/>
<br><br>
<a href="https://pypi.org/project/opentele/"><img alt="pypi version" src="https://img.shields.io/pypi/v/opentele?logo=pypi&logoColor=%232d93c1"/></a>
<a href="https://pypi.org/project/opentele/"><img alt="pypi status" src="https://img.shields.io/pypi/status/opentele?color=%2331c754&logo=pypi&logoColor=%232d93c1"/></a>
<a href="https://opentele.readthedocs.io/"><img alt="documentation" src="https://img.shields.io/readthedocs/opentele.svg?color=%2331c754&logo=readthedocs"/></a>
<a href="https://codecov.io/gh/thedemons/opentele">
<img src="https://img.shields.io/codecov/c/github/thedemons/opentele?color=%2331c754&label=codecov&logo=codecov&token=H2IWGEJ5LN"/>
</a>
<a href="https://github.com/thedemons/opentele/actions/workflows/package.yml"><img alt="workflow tests" src="https://img.shields.io/github/workflow/status/thedemons/opentele/package?logo=github&color=%2331c754"/></a>
<a href="https://github.com/thedemons/opentele/issues"><img alt="issues" src="https://img.shields.io/github/issues/thedemons/opentele?color=%2331c754&logo=github"/></a>
<a href="https://github.com/thedemons/opentele/commits/main"><img alt="github last commit" src="https://img.shields.io/github/last-commit/thedemons/opentele?color=%2331c754&logo=github"/></a>
<a href="https://github.com/thedemons/opentele/commits/main"><img alt="github commits" src="https://img.shields.io/github/commit-activity/m/thedemons/opentele?logo=github"/></a>
<a href="https://pypi.org/project/opentele/"><img alt="pypi installs" src="https://img.shields.io/pypi/dm/opentele?label=installs&logo=docusign&color=%2331c754"/></a>
<a href="https://en.wikipedia.org/wiki/MIT_License"><img alt="pypi license" src="https://img.shields.io/pypi/l/opentele?color=%2331c754&logo=gitbook&logoColor=white"/></a>
<a href="https://github.com/psf/black"><img alt="code format" src="https://img.shields.io/badge/code%20style-black-000000.svg?logo=python&logoColor=%232d93c1"/></a>
</p>
<br>
A **Python Telegram API Library** for converting between **tdata** and **telethon** sessions, with built-in **official Telegram APIs**. [**Read the documentation**](https://opentele.readthedocs.io/en/latest/documentation/telegram-desktop/tdesktop/).
# NOTICE
Unfortunately, due to the lack of interest, I can no longer maintain this project and keep it up-to-date with the latest version of Telegram Desktop and Telethon.
<br>
If you have been using opentele for a while, I appreciate it, please consider contributing to the project, ask any questions in [Discussion](https://github.com/thedemons/opentele/discussions) and I'll try to help.
## Features
- Convert [Telegram Desktop](https://github.com/telegramdesktop/tdesktop) **tdata** sessions to [telethon](https://github.com/LonamiWebs/Telethon) sessions and vice versa.
- Use **telethon** with [official APIs](#authorization) to avoid bot detection.
- Randomize [device info](https://opentele.readthedocs.io/en/latest/documentation/authorization/api/#generate) using real data that recognized by Telegram server.
## Dependencies
- [telethon](https://github.com/LonamiWebs/Telethon) - Widely used Telegram's API library for Python.
- [tgcrypto](https://github.com/pyrogram/tgcrypto) - AES-256-IGE encryption to works with `tdata`.
- [pyQt5](https://www.riverbankcomputing.com/software/pyqt/) - Used by Telegram Desktop to streams data from files.
## Installation
- Install from [PyPI](https://pypi.org/project/opentele/):
```pip title="pip"
pip install --upgrade opentele
```
## First Run
Load TDesktop from tdata folder and convert it to telethon, with a custom API:
```python
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](https://opentele.readthedocs.io/en/latest/documentation/authorization/api/#class-api).
<br>
According to [Telegram TOS](https://core.telegram.org/api/obtaining_api_id#using-the-api-id): *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*.
<br>
<br>
It also uses the **[lang_pack](https://core.telegram.org/method/initConnection)** parameter, of which [telethon can't use](https://github.com/LonamiWebs/Telethon/blob/dd51aea4db90fd255a14e27192e221c70b45e105/telethon/_client/telegrambaseclient.py#L197) because it's for official apps only.
<br>
Therefore, **there are no differences** between using opentele and official apps, the server can't tell you apart.
## Incoming Features
- [x] Writing data to tdata for converting telethon sessions to tdesktop.
- [x] Random device information for [initConnection](https://core.telegram.org/method/initConnection) to avoid spam-detection.
- [ ] Add support for [pyrogram](https://github.com/pyrogram/pyrogram).
- [ ] Develop opentele-tui using [textual](https://github.com/Textualize/textual) for non-experience user.
## Examples
The best way to learn anything is by looking at the examples. Am I right?
- Example on [readthedocs](https://opentele.readthedocs.io/en/latest/examples/)
- Example on [github](./examples)
## Documentation [](https://opentele.readthedocs.io/)
- Read documentation on [readthedocs](https://opentele.readthedocs.io/en/latest/documentation/telegram-desktop/tdesktop/)
- Read documentation on [github](https://github.com/thedemons/opentele/tree/main/docs-github)
Raw data
{
"_id": null,
"home_page": "https://github.com/thedemons/opentele",
"name": "ooptele",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "thedemons",
"author_email": "thedemons@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0c/0a/28cb6b1f74df40065086e57eac1617b823b6d13641ca6888a604e3c4a940/ooptele-1.0.1.tar.gz",
"platform": null,
"description": "<!-- vim: syntax=Markdown -->\r\n\r\n# opentele\r\n\r\n<p align=\"center\">\r\n<img src=\"https://raw.githubusercontent.com/thedemons/opentele/main/opentele.png\" alt=\"logo\" width=\"180\"/>\r\n<br><br>\r\n<a href=\"https://pypi.org/project/opentele/\"><img alt=\"pypi version\" src=\"https://img.shields.io/pypi/v/opentele?logo=pypi&logoColor=%232d93c1\"/></a>\r\n<a href=\"https://pypi.org/project/opentele/\"><img alt=\"pypi status\" src=\"https://img.shields.io/pypi/status/opentele?color=%2331c754&logo=pypi&logoColor=%232d93c1\"/></a>\r\n<a href=\"https://opentele.readthedocs.io/\"><img alt=\"documentation\" src=\"https://img.shields.io/readthedocs/opentele.svg?color=%2331c754&logo=readthedocs\"/></a>\r\n<a href=\"https://codecov.io/gh/thedemons/opentele\">\r\n<img src=\"https://img.shields.io/codecov/c/github/thedemons/opentele?color=%2331c754&label=codecov&logo=codecov&token=H2IWGEJ5LN\"/>\r\n</a>\r\n<a href=\"https://github.com/thedemons/opentele/actions/workflows/package.yml\"><img alt=\"workflow tests\" src=\"https://img.shields.io/github/workflow/status/thedemons/opentele/package?logo=github&color=%2331c754\"/></a>\r\n<a href=\"https://github.com/thedemons/opentele/issues\"><img alt=\"issues\" src=\"https://img.shields.io/github/issues/thedemons/opentele?color=%2331c754&logo=github\"/></a>\r\n<a href=\"https://github.com/thedemons/opentele/commits/main\"><img alt=\"github last commit\" src=\"https://img.shields.io/github/last-commit/thedemons/opentele?color=%2331c754&logo=github\"/></a>\r\n<a href=\"https://github.com/thedemons/opentele/commits/main\"><img alt=\"github commits\" src=\"https://img.shields.io/github/commit-activity/m/thedemons/opentele?logo=github\"/></a>\r\n<a href=\"https://pypi.org/project/opentele/\"><img alt=\"pypi installs\" src=\"https://img.shields.io/pypi/dm/opentele?label=installs&logo=docusign&color=%2331c754\"/></a>\r\n<a href=\"https://en.wikipedia.org/wiki/MIT_License\"><img alt=\"pypi license\" src=\"https://img.shields.io/pypi/l/opentele?color=%2331c754&logo=gitbook&logoColor=white\"/></a>\r\n<a href=\"https://github.com/psf/black\"><img alt=\"code format\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg?logo=python&logoColor=%232d93c1\"/></a>\r\n</p>\r\n\r\n<br>\r\n\r\nA **Python Telegram API Library** for converting between **tdata** and **telethon** sessions, with built-in **official Telegram APIs**. [**Read the documentation**](https://opentele.readthedocs.io/en/latest/documentation/telegram-desktop/tdesktop/).\r\n\r\n# NOTICE\r\nUnfortunately, due to the lack of interest, I can no longer maintain this project and keep it up-to-date with the latest version of Telegram Desktop and Telethon.\r\n<br>\r\nIf you have been using opentele for a while, I appreciate it, please consider contributing to the project, ask any questions in [Discussion](https://github.com/thedemons/opentele/discussions) and I'll try to help.\r\n\r\n## Features\r\n- Convert [Telegram Desktop](https://github.com/telegramdesktop/tdesktop) **tdata** sessions to [telethon](https://github.com/LonamiWebs/Telethon) sessions and vice versa.\r\n- Use **telethon** with [official APIs](#authorization) to avoid bot detection.\r\n- Randomize [device info](https://opentele.readthedocs.io/en/latest/documentation/authorization/api/#generate) using real data that recognized by Telegram server.\r\n\r\n## Dependencies\r\n\r\n- [telethon](https://github.com/LonamiWebs/Telethon) - Widely used Telegram's API library for Python.\r\n- [tgcrypto](https://github.com/pyrogram/tgcrypto) - AES-256-IGE encryption to works with `tdata`.\r\n- [pyQt5](https://www.riverbankcomputing.com/software/pyqt/) - Used by Telegram Desktop to streams data from files.\r\n\r\n## Installation\r\n- Install from [PyPI](https://pypi.org/project/opentele/):\r\n```pip title=\"pip\"\r\npip install --upgrade opentele\r\n```\r\n\r\n## First Run\r\nLoad TDesktop from tdata folder and convert it to telethon, with a custom API:\r\n```python\r\nfrom opentele.td import TDesktop\r\nfrom opentele.tl import TelegramClient\r\nfrom opentele.api import API, CreateNewSession, UseCurrentSession\r\nimport asyncio\r\n\r\nasync def main():\r\n \r\n # Load TDesktop client from tdata folder\r\n tdataFolder = r\"C:\\Users\\<username>\\AppData\\Roaming\\Telegram Desktop\\tdata\"\r\n tdesk = TDesktop(tdataFolder)\r\n\r\n # Using official iOS API with randomly generated device info\r\n # print(api) to see more\r\n api = API.TelegramIOS.Generate()\r\n\r\n # Convert TDesktop session to telethon client\r\n # CreateNewSession flag will use the current existing session to\r\n # authorize the new client by `Login via QR code`.\r\n client = await tdesk.ToTelethon(\"newSession.session\", CreateNewSession, api)\r\n\r\n # Although Telegram Desktop doesn't let you authorize other\r\n # sessions via QR Code (or it doesn't have that feature),\r\n # it is still available across all platforms (APIs).\r\n\r\n # Connect and print all logged in devices\r\n await client.connect()\r\n await client.PrintSessions()\r\n\r\nasyncio.run(main())\r\n```\r\n\r\n## Authorization\r\n**opentele** offers the ability to use **official APIs**, which are used by official apps. You can check that out [here](https://opentele.readthedocs.io/en/latest/documentation/authorization/api/#class-api).\r\n<br>\r\n\r\nAccording to [Telegram TOS](https://core.telegram.org/api/obtaining_api_id#using-the-api-id): *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*.\r\n<br>\r\n<br>\r\nIt also uses the **[lang_pack](https://core.telegram.org/method/initConnection)** parameter, of which [telethon can't use](https://github.com/LonamiWebs/Telethon/blob/dd51aea4db90fd255a14e27192e221c70b45e105/telethon/_client/telegrambaseclient.py#L197) because it's for official apps only.\r\n<br>\r\nTherefore, **there are no differences** between using opentele and official apps, the server can't tell you apart.\r\n\r\n## Incoming Features\r\n- [x] Writing data to tdata for converting telethon sessions to tdesktop.\r\n- [x] Random device information for [initConnection](https://core.telegram.org/method/initConnection) to avoid spam-detection.\r\n- [ ] Add support for [pyrogram](https://github.com/pyrogram/pyrogram).\r\n- [ ] Develop opentele-tui using [textual](https://github.com/Textualize/textual) for non-experience user.\r\n\r\n## Examples\r\nThe best way to learn anything is by looking at the examples. Am I right?\r\n\r\n- Example on [readthedocs](https://opentele.readthedocs.io/en/latest/examples/)\r\n- Example on [github](./examples)\r\n\r\n## Documentation [](https://opentele.readthedocs.io/)\r\n- Read documentation on [readthedocs](https://opentele.readthedocs.io/en/latest/documentation/telegram-desktop/tdesktop/)\r\n- Read documentation on [github](https://github.com/thedemons/opentele/tree/main/docs-github)\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": null,
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/thedemons/opentele"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "b01a369d7f15abc12b23066c948762854ddb0b82cf2d755cb1c0905d23c19d1d",
"md5": "99e717eedc693425f5a1994ded3b8a19",
"sha256": "3ead4cb1c2061c8c393b08db239a2bff6c6539e41d570ebec7d1e8ec9dd14bc1"
},
"downloads": -1,
"filename": "ooptele-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "99e717eedc693425f5a1994ded3b8a19",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 42145,
"upload_time": "2025-07-12T15:25:21",
"upload_time_iso_8601": "2025-07-12T15:25:21.201616Z",
"url": "https://files.pythonhosted.org/packages/b0/1a/369d7f15abc12b23066c948762854ddb0b82cf2d755cb1c0905d23c19d1d/ooptele-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0c0a28cb6b1f74df40065086e57eac1617b823b6d13641ca6888a604e3c4a940",
"md5": "3967684e197cff02ed120d9969e1223e",
"sha256": "799686dca76e37d0270658060a05e7789d20d8aa6f12770e9936220f71d0b478"
},
"downloads": -1,
"filename": "ooptele-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "3967684e197cff02ed120d9969e1223e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 38831,
"upload_time": "2025-07-12T15:25:22",
"upload_time_iso_8601": "2025-07-12T15:25:22.253565Z",
"url": "https://files.pythonhosted.org/packages/0c/0a/28cb6b1f74df40065086e57eac1617b823b6d13641ca6888a604e3c4a940/ooptele-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-12 15:25:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "thedemons",
"github_project": "opentele",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "pyqt5",
"specs": []
},
{
"name": "telethon",
"specs": []
},
{
"name": "tgcrypto",
"specs": []
}
],
"lcname": "ooptele"
}