Skip to main content

Session converter from Telethon session + json to Pyrogram and vice versa

PyPI version shields.io

Examples

From telethon to pylogram

import asyncio
import logging

from ks_session_manager.converter import Converter

API_ID = 123456
API_HASH = ""
PHONE_NUMBER = ""


async def main():
    converter = await Converter.from_telethon(PHONE_NUMBER, workdir="./telethon_sessions_path")

    try:
        await converter.export_pylogram_session()
    except FileExistsError as e:
        # Already exported
        logging.warning(e)

    client = await converter.get_pylogram_client()

    async with client:
        me = await client.get_me()
        print(me)


if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)
    asyncio.run(main())

Telethon sessions revision

import asyncio
import logging

from ks_session_manager.revisors import TelethonRevizor


async def main():
    revizor = TelethonRevizor(
        threads=20,  # How many revisions to run simultaneously
        dry_run=False  # If True, revisions will not actually connect to Telegram, only logs will be printed
    )
    await revizor.revise_all_in_path("./telethon_sessions_path", limit=20)


if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)
    asyncio.run(main())

Metadata

Release files for ks-session-manager 0.13.0

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

Source distribution (sdist)

Source distribution for ks-session-manager 0.13.0
File Size Uploaded
ks_session_manager-0.13.0.tar.gz 45.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ks-session-manager 0.13.0
File Interpreter ABI Platform
ks_session_manager-0.13.0-py3-none-any.whl Python 3 none any Details

Total release size: 100.9 kB

Release files / ks_session_manager-0.13.0.tar.gz

Download URL ks_session_manager-0.13.0.tar.gz
Size 45.7 kB
Tags Source
SHA-256 checksum
How to use checksums
665f987e806fdc128ed25a1b769f82fecb110c7dc62315659ac715f68cf323f9
BLAKE2b-256 checksum
How to use checksums
fd6d29f6c6664760557ab0e1ca8c24203f9f6c80a41f073754470c09f9d63532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ks_session_manager-0.13.0-py3-none-any.whl

Download URL ks_session_manager-0.13.0-py3-none-any.whl
Size 55.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c33ef6d63999241f342250a8e541b02666ec0711b633ac45468472e884b35659
BLAKE2b-256 checksum
How to use checksums
1f80d70a8f28d72c00fddd74ed4a7eef49f53db10f839710402d02a6bb0855a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.13.0 This release

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.2

2 release files

0.2.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