python - 我无法使用 Python 和 fbchat 作为聊天机器人登录到我的 Facebook 帐户
问题描述
这是我的代码:
from fbchat import Client, log
from fbchat.models import *
Email = '****'
Password = '****'
class Jervis(Client):
def onMessage(
self,
mid=None,
author_id=None,
message=None,
message_object=None,
thread_id=None,
thread_type=ThreadType.USER,
ts=None,
metadata=None,
msg=None,
**kwargs
):
self.markAsRead(author_id)
log.into("Message {} from {} in {}".format(message_object, thread_id, thread_type))
msgText = message_object.text
reply = "hello, i'm leonel"
if author_id != self.uid:
self.send(Message(text=reply), thread_id, thread_type=thread_type)
self.markAsRead(author_id, thread_id)
client = Jervis(email= Email, password= Password)
client.listen()
这是我得到的错误:
Attempt #1 failed, retrying
Traceback (most recent call last):
File "C:\Users\nmzub\AppData\Local\Programs\Python\Python39\lib\site-packages\fbchat\_client.py", line 205, in login
self._state = State.login(
File "C:\Users\nmzub\AppData\Local\Programs\Python\Python39\lib\site-packages\fbchat\_state.py", line 153, in login
raise _exception.FBchatUserError(
fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login/?email=nmzubayeralam%40gmail.com&cuid=AYi9BVk7M1mLfuwkBYpPmyt9BVGFy1ap622CkGSZBOYf4BHSSM37rIhOWewqwnHj71hLpWdmq_gxCwBMrcCny-5RdF34vZFGDJecmjC4HaXfYXNuUlNhAuilo-ZKkvrVGCCR5rsOn5zfna0lzZx2kXGwtz13F_Pkn3FEmW214vFT0JiE-4t-E8WlAWAA3LLfFjjMnE6SmGWDvMm5PhrQAeddGMCnmAqZmNaQVUEbxesTz2fR2Nfv21-_kQMJmyqPHBYjOAniWnOvpjsDzGPVoleEqWPUeWM6mVTRW3taVSpsRg&li=ZYx9YQ1i7Ee6FaHjRwq6wiXb&e=1348060&shbl=1&refsrc=deprecated&_rdr)
Attempt #2 failed, retrying
解决方案
推荐阅读
- reactjs - algolia 全文搜索,firebase
- java - @ControllerAdvice 注解的类没有捕捉到服务层抛出的异常
- java - 通过在 SpringBoot 中调用 REST 端点来启动 IntegrationTest
- asynchronous - rust tokio:从同步闭包中调用异步函数
- python - 打开安装 python 文件?
- c - 修改文件中的现有行并修剪该行的其余部分
- github - 如何使用 curl 和 GraphQL updateIssueComment 突变在 Github 中更新问题或 PR 评论
- purescript - 将多态记录传递给外部函数
- github - 在 github 上托管 Hugo
- dockerfile - 在 Install 阶段构建 docker 映像并在其他几个构建阶段并行使用它