opentele


Nameopentele JSON
Version 1.15.1 PyPI version JSON
download
home_pagehttps://github.com/thedemons/opentele
SummaryA Python Telegram API Library for converting between tdata and telethon sessions, with built-in official Telegram APIs.
upload_time2022-01-28 05:32:53
maintainer
docs_urlNone
authorthedemons
requires_python
licenseMIT
keywords tdata tdesktop telegram telethon opentele
VCS
bugtrack_url
requirements pyqt5 telethon tgcrypto
Travis-CI No Travis.
coveralls test coverage
            <!-- 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/).

## 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/master/telethon/client/telegrambaseclient.py#L375) 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 [![documentation](https://readthedocs.org/projects/opentele/badge/?version=latest&style=flat)](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": "opentele",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "tdata,tdesktop,telegram,telethon,opentele",
    "author": "thedemons",
    "author_email": "thedemons@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/08/68/b0e585e86700be62c268c09bc8f0281915ad01071d32c1e6704724e2b9d8/opentele-1.15.1.tar.gz",
    "platform": "",
    "description": "<!-- vim: syntax=Markdown -->\n\n# opentele\n\n<p align=\"center\">\n<img src=\"https://raw.githubusercontent.com/thedemons/opentele/main/opentele.png\" alt=\"logo\" width=\"180\"/>\n<br><br>\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>\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>\n<a href=\"https://opentele.readthedocs.io/\"><img alt=\"documentation\" src=\"https://img.shields.io/readthedocs/opentele.svg?color=%2331c754&logo=readthedocs\"/></a>\n<a href=\"https://codecov.io/gh/thedemons/opentele\">\n<img src=\"https://img.shields.io/codecov/c/github/thedemons/opentele?color=%2331c754&label=codecov&logo=codecov&token=H2IWGEJ5LN\"/>\n</a>\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>\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>\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>\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>\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>\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>\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>\n</p>\n\n<br>\n\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/).\n\n## Features\n- Convert [Telegram Desktop](https://github.com/telegramdesktop/tdesktop) **tdata** sessions to [telethon](https://github.com/LonamiWebs/Telethon) sessions and vice versa.\n- Use **telethon** with [official APIs](#authorization) to avoid bot detection.\n- Randomize [device info](https://opentele.readthedocs.io/en/latest/documentation/authorization/api/#generate) using real data that recognized by Telegram server.\n\n## Dependencies\n\n- [telethon](https://github.com/LonamiWebs/Telethon) - Widely used Telegram's API library for Python.\n- [tgcrypto](https://github.com/pyrogram/tgcrypto) - AES-256-IGE encryption to works with `tdata`.\n- [pyQt5](https://www.riverbankcomputing.com/software/pyqt/) - Used by Telegram Desktop to streams data from files.\n\n## Installation\n- Install from [PyPI](https://pypi.org/project/opentele/):\n```pip title=\"pip\"\npip install --upgrade opentele\n```\n\n## First Run\nLoad TDesktop from tdata folder and convert it to telethon, with a custom API:\n```python\nfrom opentele.td import TDesktop\nfrom opentele.tl import TelegramClient\nfrom opentele.api import API, CreateNewSession, UseCurrentSession\nimport asyncio\n\nasync def main():\n\n    # Load TDesktop client from tdata folder\n    tdataFolder = r\"C:\\Users\\<username>\\AppData\\Roaming\\Telegram Desktop\\tdata\"\n    tdesk = TDesktop(tdataFolder)\n\n    # Using official iOS API with randomly generated device info\n    # print(api) to see more\n    api = API.TelegramIOS.Generate()\n\n    # Convert TDesktop session to telethon client\n    # CreateNewSession flag will use the current existing session to\n    # authorize the new client by `Login via QR code`.\n    client = await tdesk.ToTelethon(\"newSession.session\", CreateNewSession, api)\n\n    # Although Telegram Desktop doesn't let you authorize other\n    # sessions via QR Code (or it doesn't have that feature),\n    # it is still available across all platforms (APIs).\n\n    # Connect and print all logged in devices\n    await client.connect()\n    await client.PrintSessions()\n\nasyncio.run(main())\n```\n\n## Authorization\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).\n<br>\n\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*.\n<br>\n<br>\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/master/telethon/client/telegrambaseclient.py#L375) because it's for official apps only.\n<br>\nTherefore, **there are no differences** between using opentele and official apps, the server can't tell you apart.\n\n## Incoming Features\n- [x] Writing data to tdata for converting telethon sessions to tdesktop.\n- [x] Random device information for [initConnection](https://core.telegram.org/method/initConnection) to avoid spam-detection.\n- [ ] Add support for [pyrogram](https://github.com/pyrogram/pyrogram).\n- [ ] Develop opentele-tui using [textual](https://github.com/Textualize/textual) for non-experience user.\n\n## Examples\nThe best way to learn anything is by looking at the examples. Am I right?\n\n- Example on [readthedocs](https://opentele.readthedocs.io/en/latest/examples/)\n- Example on [github](./examples)\n\n## Documentation [![documentation](https://readthedocs.org/projects/opentele/badge/?version=latest&style=flat)](https://opentele.readthedocs.io/)\n- Read documentation on [readthedocs](https://opentele.readthedocs.io/en/latest/documentation/telegram-desktop/tdesktop/)\n- Read documentation on [github](https://github.com/thedemons/opentele/tree/main/docs-github)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python Telegram API Library for converting between tdata and telethon sessions, with built-in official Telegram APIs.",
    "version": "1.15.1",
    "project_urls": {
        "Homepage": "https://github.com/thedemons/opentele"
    },
    "split_keywords": [
        "tdata",
        "tdesktop",
        "telegram",
        "telethon",
        "opentele"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ab33a1a513bea0d95aada408d3dfde2929a9d2eca8b7b02cb1d4e173862e020",
                "md5": "8c94abb503304051324ab8d139c2b1b8",
                "sha256": "c7e783937ca85d7bf4065435693c8a053fb16f69a87b645d27fd299289cd8499"
            },
            "downloads": -1,
            "filename": "opentele-1.15.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8c94abb503304051324ab8d139c2b1b8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 81252,
            "upload_time": "2022-01-28T05:32:51",
            "upload_time_iso_8601": "2022-01-28T05:32:51.842484Z",
            "url": "https://files.pythonhosted.org/packages/0a/b3/3a1a513bea0d95aada408d3dfde2929a9d2eca8b7b02cb1d4e173862e020/opentele-1.15.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0868b0e585e86700be62c268c09bc8f0281915ad01071d32c1e6704724e2b9d8",
                "md5": "be3106e00e5b3306e5ba5a407cce5942",
                "sha256": "366b258b6b02c33c24d47d007cb8f188b9b2a13c713585c01cb4174966fb953d"
            },
            "downloads": -1,
            "filename": "opentele-1.15.1.tar.gz",
            "has_sig": false,
            "md5_digest": "be3106e00e5b3306e5ba5a407cce5942",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 74026,
            "upload_time": "2022-01-28T05:32:53",
            "upload_time_iso_8601": "2022-01-28T05:32:53.820331Z",
            "url": "https://files.pythonhosted.org/packages/08/68/b0e585e86700be62c268c09bc8f0281915ad01071d32c1e6704724e2b9d8/opentele-1.15.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-01-28 05:32:53",
    "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": "opentele"
}
        
Elapsed time: 0.24573s