Unable to login | fbchat.Client

2QdxY4RzWzUUiLuE at potatochowder.com 2QdxY4RzWzUUiLuE at potatochowder.com
Sat Jul 11 09:43:25 EDT 2020


On 2020-07-11 at 12:56:22 +0530,
Shivam Dutt Sharma <shivamdutt606 at gmail.com> wrote:

> *Logging in xxxxxx.x.xxxxxx...
> Attempt #1 failed, retrying
> Traceback (most recent call last):
>   File "C:\Users\my\Anaconda3\lib\site-packages\fbchat\_client.py",
> line 209, in login
>     user_agent=user_agent,
>   File "C:\Users\my\Anaconda3\lib\site-packages\fbchat\_state.py",
> line 149, in login
>     return cls.from_session(session=session)
>   File "C:\Users\my\Anaconda3\lib\site-packages\fbchat\_state.py",
> line 186, in from_session
>     fb_dtsg = FB_DTSG_REGEX.search(r.text).group(1)
> AttributeError: 'NoneType' object has no attribute 'group'*

I don't know anything about fbchat, but it looks like
FB_DTSG_REGEX.search is returning None (indicating that the search
failed), which doesn't have an attribute named "group."

I would suggest breaking up fb_dtsg =
FB_DTSG_REGEX.search(r.text).group(1) into multiple statements and
testing the result of the search before assuming that there's a group
attribute:

    xxx = FB_DTSG_REGEX.search(r.text)
    if xxx:
        fb_dtsg = xxx.group(1)
    else:
        print("the search failed, now what?")


More information about the Python-list mailing list