TelegramIndex-Fork/app/generate_session_string.py

11 lines
340 B
Python
Raw Normal View History

2020-12-12 15:16:44 +01:00
import os
2020-08-10 09:35:47 +02:00
from telethon.sync import TelegramClient
from telethon.sessions import StringSession
2020-12-12 15:16:44 +01:00
api_id = int(os.environ.get('API_ID') or input("Enter your API_ID: "))
api_hash = os.environ.get('API_HASH') or input("Enter your API_HASH: ")
2020-08-10 09:35:47 +02:00
with TelegramClient(StringSession(), api_id, api_hash) as client:
print(client.session.save())