I dont know what I am doing wrong please help me to fix this... I am trying to build a telegram bot and with the help of many github researches, I came up with this code. But I am facing this error please help to solve it.
from telethon import TelegramClient, connection
import logging
from telethon import sync, TelegramClient, events
import json
with open('config.json', 'r') as f:
config = json.loads(f.read())
logging.basicConfig(level=logging.WARNING)
accounts = config['accounts']
folder_session = 'session/'
for account in accounts:
api_id = account['api_id']
api_hash = account['api_hash']
phone = account['phone']
print(phone)
client = TelegramClient(folder_session + phone, api_id, api_hash)
client.start()
if client.is_user_authorized():
print('Login success')
else:
print('Login fail')
client.disconnect()
_________________________________________________________________________________________________*
OperationalError Traceback (most recent call last)
<ipython-input-3-dd3766aaae79> in <module>
19 print(phone)
20
---> 21 client = TelegramClient(folder_session + phone, api_id, api_hash)
22 client.start()
23 if client.is_user_authorized():
You just need to create a folder named session in the same directory of that Python file.