i use this script for connect and create sessions in telethon
from telethon import TelegramClient
from telethon.tl.functions.messages import GetHistoryRequest
from telethon.utils import get_input_peer
api_id = 7****
api_hash = 'ef584d*****************'
client = TelegramClient('+15159947451', api_id, api_hash)
client.connect()
if not client.is_user_authorized():
client.send_code_request('+15159947451')
client.sign_in('+15159947451', cod)
with this cod i can login good in this number telegram and create file:+15159947451.session.
now i close and disconnect, how i can again login this number with this file +15159947451.session.
i use this code but this code have error:
from telethon import TelegramClient
from telethon.tl.functions.messages import GetHistoryRequest
from telethon.utils import get_input_peer
api_id = 7****
api_hash = 'ef584d180eee*******************'
number='+15152934803'
client = TelegramClient('00', api_id, api_hash)
client.session.try_load_or_create_new(session_user_id='+15159947451')
client.connect()
but i have this error
raise error
telethon.errors.RPCError: (RPCError(...), 'AUTH_KEY_UNREGISTERED (401): The key is not registered in the system.')