简体   繁体   English

Python fbchat - 登录失败

[英]Python fbchat - Login failed

I am currently trying to use fbchat ( https://github.com/carpedm20/fbchat ) to build a small FB-Bot, but I can not login with fbchat.我目前正在尝试使用 fbchat ( https://github.com/carpedm20/fbchat ) 来构建一个小型 FB-Bot,但我无法使用 fbchat 登录。

I took the code directly from the examples, but when I try to login it fails.我直接从示例中获取了代码,但是当我尝试登录时却失败了。 In Facebook I do get the message, that someone with an unknown browser tried to login - I accept this message ("This was me") but it is shown everytime I try to login via the script.在 Facebook 中,我确实收到消息,有人使用未知浏览器尝试登录 - 我接受此消息(“这是我”),但每次我尝试通过脚本登录时都会显示它。 Username and Password are correct.用户名和密码正确。

import fbchat
client = fbchat.Client("123456789", "987654321")
friends = client.getUsers("FRIEND'S NAME")  # return a list of names

Any ideas?有任何想法吗?

Thank you谢谢

Are you running the code on a vps or from an IP address different than the one that you usually use to log in to your Facebook account?您是在 vps 上运行代码还是从与您通常用于登录 Facebook 帐户的 IP 地址不同的 IP 地址运行代码?

If so, try SSH tunneling through that IP address, and login to Facebook with a browser.如果是这样,请尝试通过该 IP 地址建立 SSH 隧道,然后使用浏览器登录 Facebook

The point is, you need to login to Facebook with a browser from that IP address.关键是,您需要使用该 IP 地址的浏览器登录 Facebook。 There are some verification steps that can only be done with a browser.有一些验证步骤只能使用浏览器完成。 FB will also ask you to change your password, follow through and do it. FB 还会要求您更改密码,按照操作进行操作。 Then, your code should be good to go.然后,您的代码应该可以正常运行。 You might have to do this again after a few hours if your client disconnects, but after 3-4 times, FB will acknowledge the new IP address as "safe" and you'll be all set.如果您的客户端断开连接,您可能需要在几小时后再次执行此操作,但是 3-4 次后,FB 会将新 IP 地址确认为“安全”,您就可以完成设置了。

https://github.com/fbchat-dev/fbchat https://github.com/fbchat-dev/fbchat

as of 23 Sept 2020截至 2020 年 9 月 23 日

"This project is officially marked as unmaintained, since my life is somewhere where I just do not have the time and energy to lead this project. " “这个项目被正式标记为未维护,因为我的生活在某个地方,我只是没有时间和精力来领导这个项目。”

I found this error when I expererienced similar problems while trying a demo tutorial.我在尝试演示教程时遇到类似问题时发现了此错误。

I would restrict my efforts to a package currently maintained.我会将我的努力限制在当前维护的软件包上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM