fbchat
fbchat copied to clipboard
Login failed for 2FA enabled account.
Description of the problem
Can't login to the account which have 2FA enabled. Login works fine with the account which doesn't have 2FA enabled.
Code I'm using:
def login_logout():
cookies = {}
try:
# Load the session cookies
if os.path.isfile('session.json'):
with open('session.json', 'r') as f:
cookies = json.load(f)
except:
os.remove('session.json')
# If it fails, never mind, we'll just login again
# client = CustomClient(email, password, max_tries=1)
if((not cookies) != True):
client = CustomClient(email, password, session_cookies=cookies, user_agent=user_agent, max_tries=1)
else:
client = CustomClient(email, password, user_agent=user_agent, max_tries=1)
with open('session.json', 'w') as f:
json.dump(client.getSession(), f)
print("\nProgram Started!\n")
client.listen()
Error I'm getting
Traceback (most recent call last):
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python36\lib\site-pa
ckages\fbchat\_client.py", line 175, in setSession
self._state = State.from_cookies(session_cookies, user_agent=user_agent)
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python36\lib\site-pa
ckages\fbchat\_state.py", line 208, in from_cookies
return cls.from_session(session=session)
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python36\lib\site-pa
ckages\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 version 3.6.8
-
fbchat
version 1.9.6