Created
August 18, 2025 14:10
-
-
Save wotori/f25af1b555579ff2ab0e518da474041a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from telethon import TelegramClient | |
| from telethon.sessions import StringSession | |
| API_ID = int(input("API_ID: ")) | |
| API_HASH = input("API_HASH: ") | |
| with TelegramClient(StringSession(), API_ID, API_HASH) as client: | |
| print("STRING_SESSION=", client.session.save()) |
Author
Author
import asyncio
from telethon import TelegramClient
from telethon.sessions import StringSession
API_ID = int(input("API_ID: "))
API_HASH = input("API_HASH: "))
async def main():
async with TelegramClient(StringSession(), API_ID, API_HASH) as client:
print("STRING_SESSION=", client.session.save())
if __name__ == "__main__":
asyncio.run(main())
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
import asyncio
from telethon import TelegramClient
from telethon.sessions import StringSession
API_ID = int(input("API_ID: "))
API_HASH = input("API_HASH: "))
async def main():
async with TelegramClient(StringSession(), API_ID, API_HASH) as client:
print("STRING_SESSION=", client.session.save())
if name == "main":
asyncio.run(main())