I write a script and it’s totally working. The problem is when I run in termux (android terminal) this script send me verification code, but when I run in heroku (cloud service) it didn’t accept the verification code.
This is my script:
import time
import asyncio
import sys
import random
from telethon import TelegramClient, events, utils, Button
api_id = xxx
api_hash = 'xxx'
sesi_file = 'xxx'
bot = ' '
with TelegramClient(sesi_file, api_id, api_hash) as client:
client.loop.run_until_complete(client.send_message(bot, '/homesx'))
@client.on(events.NewMessage(from_users=bot))
async def handler(event):
pesan = event.raw_text
file = open("homesx.txt","a+")
My script
client.start()
client.run_until_disconnected()
print(time.asctime(), '-', '
Can somebody tell me why I can’t receive a verification code in heroku when i run that script?
Because I received the verif code when run in termux.
2
Answers
Heroku is a hosting service not a terminal.There is more than one way to bypass asking of verification code.first one is to use a session_string and second way is to use .session file. Check out the full documentation about session here
what you can do is to create a session_string and pass it as argument to client object.