Skip to main content

This module is small util for converting Telegram sessions to various formats (Telethon, Pyrogram, Tdata)

Project description

TGSessionsConverter

PyPI PyPI - License

This module is small util for easy converting Telegram sessions to various formats (Telethon, Pyrogram, Tdata)


Installation

$ pip install TGSessionsConverter

Quickstart

  1. in the first step: Converting your format to a TelegramSession instance
from tg_converter import TelegramSession
import io

API_ID = 123
API_HASH = "Your API HASH"

# From SQLite telethon\pyrogram session file
session = TelegramSession.from_sqlite_session_file("my_session_file.session", API_ID, API_HASH)

# From SQLite telethon\pyrogram session file bytes stream (io.BytesIO)
with open("my_example_file.session", "rb") as file:
    session_stream = io.BytesIO(file.read())
session = TelegramSession.from_telethon_sqlite_stream(session_stream, API_ID, API_HASH)
  1. Converting TelegramSession instance to the format whats you need
from tg_converter import TelegramSession

session = TelegramSession(...) # See first step to learn how to create from various formats

# To telethon client
client = session.make_telethon(sync=True) # Use MemorySession as default, see docs
client.connect()
client.send_message("me", "Hello, World!")
client.disconnect()

# To telethon session file (SQLite)
session.make_telethon_session_file("telethon.session")

Docs

How it works

An authorization session consists of an authorization key and some additional data required to connect. The module simply extracts this data and creates an instance of TelegramSession based on it, the methods of which are convenient to use to convert to the format you need.

TelegramSession

...

Converting to the format whats you need

...

TODO

  • From telethon\pyrogram SQLite session file
  • From telethon\pyrogram SQLite session stream
  • From tdata
  • To telethon client object (Sync\Async)
  • To telethon SQLite session file
  • To pyrogram client object
  • To pyrogram SQLite session file
  • To tdata
  • From telethon client object
  • From pyrogram client object
  • CLI usage
  • Write normal docs

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

TGSessionsConverter-0.0.5-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file TGSessionsConverter-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for TGSessionsConverter-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7ffb9e26911a70b7eebc22aa2e469fa3d9ba0899672fbcfeea7b6dd7c714d22d
MD5 b35703958463f0a0493ad641f045980a
BLAKE2b-256 9829a8854504d69767918a4304cd863736a1bb20933c1a88f71b6fb7c9acbcb7

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