we have a script to download files from Telegram Channel, using Telethon library for Python.
To create a Telethon instance, we using TelegramClient constructor. This method asks the user to insert his Telegram number to the console, then Telegram sends a security number, that should be written back to the console.
This authentication saved in Object/File/DB called session, so in the next execution, the TelegramClient will not ask for the phone number again.
Now, I want to create a Docker image for the script, and it's mean that when the user will create a container from the published Image, he will have to do an authentication process, and this is the question:
Which ways we have to do this authentication at most automatic as possible?
We can use Docker tricks, Telegram/Telethon tricks, and maybe Python tricks...
I will try to suggest one option to solve this.
We can save the session in the host file system, and set the location of the session as a volume for the docker container.
Then we can create a script for authenticating and creating this session, out of a container, and when the container will start it will have a session already.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With