fbchat-dev / fbchat

Facebook Chat (Messenger) for Python
https://fbchat.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.19k stars 412 forks source link

Could not find fb_dtsg #654

Open CunningBard opened 3 years ago

CunningBard commented 3 years ago

I'm new to fbchat 2.0.0a2, I didn't get any problems from using 1.9, I don't know if it's just me being a dumb or just not knowing a Important info

Code to reproduce

import fbchat
import Essentials.esen

print(fbchat.__version__)

session = fbchat.Session.login(Essentials.esen.email, Essentials.esen.password)
client = fbchat.Client(session=session)

def my_function(Event: fbchat.MessageEvent):
    print(f"Message from {event.author.id}: {event.message.text}")

listener = fbchat.Listener(session=session, chat_on=False, foreground=False, sequence_id=None, sync_token=None)
# Pycharm please shut up about sequence_id

for event in listener.listen():
    if isinstance(event, fbchat.MessageEvent):
        my_function(event)

Traceback

2.0.0a2
Traceback (most recent call last):
  File "D:\GameDev-Programming\Python\Messenger\Messenger Bot 2.0\main.py", line 6, in <module>
    session = fbchat.Session.login(Essentials.esen.email, Essentials.esen.password)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\fbchat\_session.py", line 250, in login
    return cls._from_session(session=session)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\fbchat\_session.py", line 317, in _from_session
    raise _exception.NotLoggedIn("Could not find fb_dtsg")
fbchat.NotLoggedIn: Could not find fb_dtsg

Environment information