Telethon sign_up方法始终返回PhoneCodeInvalidError

问题描述

我正在编写一个程序,该程序使用sign_up method提供的telethon library创建电报帐户。当我输入程序发送到手机的代码时,尽管代码有效,它仍返回PhoneCodeInvalidError

from telethon import TelegramClient


async def main():

     phone = '+390000000000'

     await client.connect()

     await client.send_code_request(phone)

     code = input('enter code: ')
     await client.sign_up(phone=phone,code=code,first_name="Anna")


if __name__ == '__main__':
     client = TelegramClient('helohelohelo',12345,abcdefghi)
     client.loop.run_until_complete(main())

我一直在到处寻找解决方案,很少有人谈论这个问题,而且我阅读的几乎所有内容都没有清晰的分辨率说明。

我已经阅读了有关此问题的所有信息: 123

解决方法

通过电报发送的任何代码都会立即失效。尝试在代码的每个数字之间放置空格。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...