fbchat
fbchat copied to clipboard
fbchat.NotLoggedIn: Password Forgotten account?
Description of the problem
Logging in fails.
Code to reproduce
# Example code
import getpass
import fbchat
session = fbchat.Session.login("<email/phone number>", getpass.getpass())
user = fbchat.User(session=session, id=session.user_id)
user.send_text("Test message!")
Traceback
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\user\Downloads\fbchat\fbchat-master\fbchat\_session.py", line 32
4, in login
raise _exception.NotLoggedIn(error)
fbchat.NotLoggedIn: Password Forgotten account?
Environment information
- Python version 3.7.6
-
fbchat
version 1.9.7 - If relevant, output from
$ python -m pip list
Package Version
-------------- ----------
aenum 2.2.3
attrs 19.3.0
autopep8 1.5.3
beautifulsoup4 4.9.1
bs4 0.0.1
certifi 2020.4.5.2
chardet 3.0.4
docutils 0.16
fbchat 1.9.7
idna 2.9
Kivy 1.11.1
kivy-deps.glew 0.1.12
kivy-deps.sdl2 0.1.23
Kivy-Garden 0.1.4
kivymd 0.104.1
paho-mqtt 1.5.0
Pillow 7.2.0
pip 20.1.1
pycodestyle 2.6.0
Pygments 2.6.1
pypiwin32 223
python-dotenv 0.14.0
pywin32 228
requests 2.23.0
selenium 3.141.0
setuptools 47.3.1
soupsieve 2.0.1
toml 0.10.1
urllib3 1.25.9
wheel 0.34.2
I can reproduce this error on v2.0.0a5 when logging in via username/password.
Logging in via saved session also seems to fail, with the message below and a massive wall of HTML.
fbchat.ParseError: Could not find enough ServerJSDefine. Please report this, along with the data below!
Looks like the exception is being raised here, indicating that there's a missing Location header in the response. Seems like Facebook may have changed the redirection logic and no longer redirects after a successful login via a POST to that route.
As for the session issue, exception is being raised here, so the HTML dump I mentioned above isn't being parsed properly (there is only one define_split
?). Not sure if this change is related to the email/password failure or separate.
Edit: I'm pretty sure they're related, since the content of the response to the POST that is no longer redirecting looks very similar to the HTML dump given by the session error.
@madsmtm any idea how to fix this?
No progress on this issue?
Okay, this works from fbchat.readthedocs.io.
from fbchat import Client
from fbchat.models import *
client = Client("<email>", "<password>")
client.send(Message(text="Hi me!"), thread_id=client.uid, thread_type=ThreadType.USER)
client.logout()
But facebook blocked my account after 3 days. I didn't send any message through the bot.