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.10.1.tar.gz (47.5 kB view details)

Uploaded Source

Built Distribution

ks_session_manager-0.10.1-py3-none-any.whl (55.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ks_session_manager-0.10.1.tar.gz
  • Upload date:
  • Size: 47.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ks_session_manager-0.10.1.tar.gz
Algorithm Hash digest
SHA256 0e20561ff1270eb274ac375cfd368e016829f31dd0b3b075ef499fbf4daff00e
MD5 a6feb6c80d339e0ce09edeacec49e80e
BLAKE2b-256 a2bdab483d0bc03fd565eb7ca8d6256b7ddec4f9924288de2c16b52c2610b65d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ks_session_manager-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 80f46ff65d798fe686b02b9780e2042447b9726030c61ed606ab291aa81ef8aa
MD5 a2358b8cc1d17f901a9925252bc8d1dd
BLAKE2b-256 bd1746763e7cca6e7d275a93983feef5c75ada8945d7b9fd1f9c605714427446

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