我有一个需要授权的电话号码,为了授权,我需要使用电话,而不是消息。
我尝试过执行以下操作:
from pyrogram.raw.functions.auth import SendCode
from pyrogram.raw.types import CodeSettings
phone = "12022177028"
api_id = 2382333
api_hash = "3121cc5e4a42121470161f1c1558a321"
res = SendCode(
phone_number=phone,
api_id=api_id,
api_hash=api_hash,
settings=CodeSettings(
allow_flashcall=True,
current_number=True,
allow_app_hash=False
)
)
在 res 变量中,我得到以下输出:
{
"_": "functions.auth.SendCode",
"phone_number": "12022177028",
"api_id": 2382333,
"api_hash": "3121cc5e4a42121470161f1c1558a321",
"settings": {
"_": "types.CodeSettings",
"allow_flashcall": true,
"current_number": true,
"allow_app_hash": false
}
}
从 pyrogram 文档中,我意识到我们可以使用 send_code 方法发送确认信息,但它只接受电话号码,并且无法传输我从 SendCode 收到的列表。
于是就出现了下面的问题,登录telegram账号时,如何不通过短信,而是通过电话确认入口?
如果您能提供其他python框架或telethon中的示例,我将非常感谢您!