KS session manager
Project description
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())
Project details
Release history Release notifications | RSS feed
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.3.0.tar.gz
(47.1 kB
view hashes)
Built Distribution
Close
Hashes for ks_session_manager-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 749ea3f9e12c8f624030f141c4edd77705b200a3d2d2e74be2edd09e9106408f |
|
MD5 | 5ba8fb27d1a56f73c117c7e0a91d994c |
|
BLAKE2b-256 | 4fd37c61adc16b95c93ac8131496ee3601a83bf1c4a28944cfe16451d1f06e22 |