Reputation:
I have created a telegram app via https://my.telegram.org. After I did that I got data about api_id and api_hash but I can't find session name. Where can I find it?
When I use telethon function TelegramClient, I need to pass there SESSION:
from telethon import TelegramClient
client = TelegramClient(SESSION, API_ID, API_HASH)
I can't find the session name
Upvotes: 3
Views: 7648
Reputation: 43884
Where can I find it?
You cant, you'll need to create it.
Telethon sessions are used to save the data of your current session.
They're not part of the Telegram API, just something Telethon introduced.
The first parameter you pass to the constructor of the
TelegramClient
is the session, and defaults to be the session name (or full path). That is, if you create aTelegramClient('anon')
instance and connect, ananon.session
file will be created in the working directory.
The file name of the session file to be used if a string is given (it may be a full path), or the Session instance to be used otherwise. If it’s
None
, the session will not be saved, and you should calllog_out()
when you’re done.
You can just pass None
(to not save a session), or a 'usefull' name like Anon
:
client = TelegramClient('anon', '19071234', 'e40ef8a46648716835434')
client.start()
Upvotes: 2