fbchat-dev / fbchat-dev/fbchat
Client() not working
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 403
- PR merge metrics
- No merged PRs in 30d
Description
## Description of the problem
Client not working properly. It shows that I'm logging in facebook from some browser on
my phone (I set it up so that it shows me messages when I'm logging in from somewhere) but it crashes in the command prompt.
## Traceback
Traceback (most recent call last):
File "sitakscool.py", line 9, in
client = Client(username, getpass(), max_tries = 1)
File "C:\*\Local\Programs\Python\Python38\lib\site-packages\fbchat\_client.py", line 103, in __init__
self.login(email, password, max_tries, user_agent=user_agent)
File "C:\*\Local\Programs\Python\Python38\lib\site-packages\fbchat\_client.py", line 205, in login
self._state = State.login(
File "C:\*\Local\Programs\Python\Python38\lib\site-packages\fbchat\_state.py", line 149, in login
return cls.from_session(session=session)
File "C:\*\Local\Programs\Python\Python38\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'
## Environment information
- Python 3.8.3
- fbchat 1.9.7
No code after _client = Client(..)_ works.
## Code
```
import os
from fbchat import Client
from fbchat.models import *
from getpass import getpass
from time import sleep
username = "MAIL"
client = Client(username, getpass(), max_tries = 1)
if client.isLoggedIn():
name = "GROUP NAME"
friends = client.searchForGroups(name)
friend = friends[0]
thread_type = ThreadType.GROUP
if os.path.exists('fromrtou.txt'):
with open('fromrtou.txt', 'r', encoding='utf-8') as data:
for each_line in data:
if each_line == '\n':
msg = ("######")
else:
msg = (each_line)
client.send(Message(text = msg), thread_id=friend.uid, thread_type=thread_type)
sleep(2)
else:
print("Sellist faili ei eksisteeri!")
client.logout()
else:
print("Midagi laks perse ja ei saanudki sisse logida!")
```
Contributor guide
Assessment
This issue has not been assessed yet.