Skip to main content

KS session manager

Project description

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())

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

ks_session_manager-0.12.0.tar.gz (47.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ks_session_manager-0.12.0-py3-none-any.whl (55.1 kB view details)

Uploaded Python 3

File details

Details for the file ks_session_manager-0.12.0.tar.gz.

File metadata

  • Download URL: ks_session_manager-0.12.0.tar.gz
  • Upload date:
  • Size: 47.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ks_session_manager-0.12.0.tar.gz
Algorithm Hash digest
SHA256 180f6e65ff1dd28f109ba9dd855a53de010bac0243039576e4daa3dfcb137541
MD5 2452d0de1570bc4b6b801b45a32e9129
BLAKE2b-256 dd71fedbbb0885d8762fa47f9273269db8cba9805c4fd06d140fcdebad104f6e

See more details on using hashes here.

File details

Details for the file ks_session_manager-0.12.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ks_session_manager-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05829ddc9cd4c4592afb0aec3224cc49a2c90c899d3a07686d7420dce8465f4a
MD5 0408a3d8f192580d74c19165fc654a2f
BLAKE2b-256 8a0028db52db70818de796c37e1ea088dec4d2889c40ece471bb5fd158ff8812

See more details on using hashes here.

Supported by

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