fbchat
fbchat copied to clipboard
Can't Log in
I'm trying to log in, but I can't The code is: from fbchat import Client from fbchat.models import * if not client.isLoggedIn(): client = Client('PHONE', 'PASS')
The Traceback:
Logging in PHONE NUMBER...
Attempt #1 failed, retrying
Traceback (most recent call last):
File "C:\Users\MemeB\AppData\Local\Programs\Python\Python310\lib\site-packages\fbchat_client.py", line 205, in login
self._state = State.login(
File "C:\Users\MemeB\AppData\Local\Programs\Python\Python310\lib\site-packages\fbchat_state.py", line 151, in login
return cls.from_session(session=session)
File "C:\Users\MemeB\AppData\Local\Programs\Python\Python310\lib\site-packages\fbchat_state.py", line 190, in from_session
revision = int(r.text.split('"client_revision":', 1)[1].split(",", 1)[0])
IndexError: list index out of range
( then it retries 3 more times )
IndexError: list index out of range
Traceback (most recent call last):
File "O:\P\Messenger_script.py", line 3, in
Python 3.10.0 Fbchat 1.9.7
@CaptainCaramel from what I see , Facebook (Meta) change a lot of stuff constantly and in the README which is displayed under the project it says that this library is no longer supported.
I saw that they utilize the m.facebook in order to login etc. if you manually go and try to open from your PC browser the part with messenger you are introduced to an error. The idea is that when you open mobile version from phone it will redirect to messenger app.
I dont think that this library can be reworked to work with messenger web-page , but if you or any other interested person has the needed knowledge , please help the community and re-work the logic.
@CaptainCaramel i saw this thread https://github.com/fbchat-dev/fbchat/issues/656 , installed python3.7 and changed the value and everything works for me. Maybe something changed in latest python3.10 so just do that and you can use it

Try changing revision to 1 _state.py
Hello,
I did what you say @minevsve and @noahosmont but I have a similar issue:
File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_client.py", line 209, in login
user_agent=user_agent,
File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_state.py", line 155, in login
"(Failed on url: {})".format(r.url)
fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login.php?login_attempt=1)
Attempt #2 failed, retrying
Traceback (most recent call last):
File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_client.py", line 209, in login
user_agent=user_agent,
File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_state.py", line 155, in login
"(Failed on url: {})".format(r.url)
fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login.php?login_attempt=1)
Attempt #3 failed, retrying
Traceback (most recent call last):
File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_client.py", line 209, in login
user_agent=user_agent,
File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_state.py", line 155, in login
"(Failed on url: {})".format(r.url)
fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login.php?login_attempt=1)
Attempt #4 failed, retrying
Traceback (most recent call last):
File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_client.py", line 209, in login
user_agent=user_agent,
File "/Users/David/.pyenv/versions/3.7.13/lib/python3.7/site-packages/fbchat/_state.py", line 155, in login
"(Failed on url: {})".format(r.url)
fbchat._exception.FBchatUserError: Login failed. Check email/password. (Failed on url: https://m.facebook.com/login.php?login_attempt=1)
Traceback (most recent call last):
File "messenger_bot_sandra.py", line 13, in
I ran this file with pyhton 3.7.13 (pyenv)
Do you have any idea of what can i do ?
thanks !
@DavidFrancisco27 we have the same problem, have you fixed it? I believe facebook changed something in their end which probably hasnt been worked out in this library
Hi @AlizerUncaged, unfortunately I haven't fix this problem. I didn't look too much these days but at this point, I really want find a solution too.. The thing is, facebook and messenger are separate now. So I don't know if this code can still work even if we make some change on it.
Hello, i have this same issue, did somebody repair it?