The problem is this line:
client = TelegramClient('+15xxxxxxxxx', api_id, api_hash)
You do not need to pass your phone number as the first parameter. You must pass a session name, for example, "myname".
You get the following:
telethon.errors.RPCError: (RPCError(...), 'AUTH_KEY_UNREGISTERED (401): The key is not registered in the system.')
( "00" ), . , :
client = TelegramClient('some_name', api_id, api_hash)
client.connect()
if not client.is_user_authorized():
client.send_code_request('+15xxxxxxxxx')
client.sign_in('+15xxxxxxxxx', cod)
.send_code_request(...):
client = TelegramClient('some_name', api_id, api_hash)
client.connect()
, "some_name" .session, , . , .session , , ( ).