Session converter from Telethon session + json to Pyrogram and vice versa
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)
| File | Size | Uploaded | |
|---|---|---|---|
| ks_session_manager-0.13.0.tar.gz | 45.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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}
|