python - Telethon / Telegram - Convert tData to sessionString for Telethon

Job ID: 32183443

Budget: €30 – €250 EUR

Hello,

given:
- tdata-Folder
- log.txt
- (api_id, api_hash)

When you put them in Telegram Desktop (Official) - Portable Version in the Folder, then if you start Telegram you are directly logged in and authenticated, directly usable.
(This works on Windows, but should work also on linux ( i think ~/.local/shar/TelegramDesktop/tdata)

I want to use telethon, but for that i have to authenticate first on TG (insert the code which TG sends me to the TG Application). After that i can print a session string, with that string i dont have to authenticate it a second time.

I want to automate this step.
I see 2 possible Solutions (but feel free to get your own way):
- convert tdata directly to Telethon session
- write a script which extracts the code from the text_Message in Telegram Desktop Application
After that i can construct the sessionString myself
- export the chats and find the typical code

Key requirements:
- no User interaction requiered (not once)
- i put tdata-directory, log.txt and your script / helpers in a folder, and when i execute the script it should output the registration-code / auth-code (or the message from telegram)

Example tData-directory and log.txt can be provided if asked
Related categories: Python Linux Shell Script Telegram API