fbchat
fbchat copied to clipboard
Client() not working
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
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!")
Did you try removing the line: client.logout()