Open Mahmoussam opened 4 years ago
Can confirm, same issue here with 1.9.6.
Same here, tried versions 1.9.{5,6,7}.
I have the same issue recently. In my case the issue only appear when using different user_agent
from fbchat import Client
client = Client("email", "pswd")
from fbchat import Client
USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"
client = Client("email", "pswd", user_agent=USER_AGENT)
Logging in username...
Please enter your 2FA code --> xxxxxx
Submitting 2FA code.
Saving browser.
Starting Facebook checkup flow.
Verifying login attempt.
Saving device again.
Attempt #1 failed, retrying
Traceback (most recent call last):
File "/Users/trangcongloc/Desktop/Dev/py-Ins/venv/lib/python3.7/site-packages/fbchat/_client.py", line 209, in login
user_agent=user_agent,
File "/Users/trangcongloc/Desktop/Dev/py-Ins/venv/lib/python3.7/site-packages/fbchat/_state.py", line 151, in login
return cls.from_session(session=session)
File "/Users/trangcongloc/Desktop/Dev/py-Ins/venv/lib/python3.7/site-packages/fbchat/_state.py", line 188, in from_session
fb_dtsg = FB_DTSG_REGEX.search(r.text).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
python 3.7.7
fbchat 1.9.7
requests 2.24.0
urllib3 1.25.9
you must delete client.logout(), it work for me
I am facing the same error while trying to log-in to fbchat.Client. This is obviously despite me entering absolutely correct ID & P/W. It could be because of any latest update in the package, or a user_agent / session (cookies) issue too. Prima-facie, if you think a few adjustments need to be made in the client or state file/s, please let me know, else I shall share the complete code link for your perusal.
Below's the error message. I will be highly grateful, if I can get an idea of where am I going wrong?
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'
The same here. Started a couple of days ago and no changes in code was done. It "just happened". Someone please help as I'm lost here. The same stuff happens with my "real" code: Example code debug log:
Logging in FBemail@email.com... INFO:client:Logging in FBemail@email.com... DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): m.facebook.com:443 DEBUG:urllib3.connectionpool:https://m.facebook.com:443 "GET / HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:https://m.facebook.com:443 "POST /login.php?login_attempt=1 HTTP/1.1" 302 0 DEBUG:urllib3.connectionpool:https://m.facebook.com:443 "GET /home.php?refsrc=https%3A%2F%2Fwww.facebook.com%2F&_rdr HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): www.facebook.com:443 DEBUG:urllib3.connectionpool:https://www.facebook.com:443 "GET / HTTP/1.1" 200 0
Traceback (most recent call last): File "simple.py", line 7, in client = Client('FBemail@email.com', 'FBpwd', max_tries=1) File "C:\Users\HP\Anaconda3\lib\site-packages\fbchat_client.py", line 103, in init self.login(email, password, max_tries, user_agent=user_agent) File "C:\Users\HP\Anaconda3\lib\site-packages\fbchat_client.py", line 209, in login user_agent=user_agent, File "C:\Users\HP\Anaconda3\lib\site-packages\fbchat_state.py", line 149, in login return cls.from_session(session=session) File "C:\Users\HP\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'm trying to figure out what is happening.
In fact in _state.py ; from_session method a "get" on facebook.com return a 200 response but with empty content (Content-Length = 0) : This is not a normal thing, Facebook should return the home page with the login fields.
I experience this problem too. It started at yesterday evening and my account blocked, Facebook asks my phone number and a picture from me.
I don't know about you guys, but switching back to "old" facebook fixed it for me.
I don't know about you guys, but switching back to "old" facebook fixed it for me.
How do you do that?
Can confirm it works with the old facebook... Hope an update soon to support the new one.
You can do that by passing an OLD user agent :
client = Client(login, password, user_agent="Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko")
Can confirm it works with the old facebook... Hope an update soon to support the new one.
You can do that by passing an OLD user agent :
client = Client(login, password, user_agent="Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko")
It's not working for me...
File "/home/pi/PythonProgramming/ArtemisCore/MessengerListenerAgent.py", line 210, in
The same problem is happening for me. I think the html was changed and the regex is not working now. Any updates coming soon? I'm still unable to log in, since facebook made the new mode permanent. If there is anything I could help with I would be glad to.
Description of the problem
when running this examle code i can't login and get errors.
Code to reproduce
Traceback
Environment information
fbchat
version:1.9.6$ python -m pip list
If you have done any research, include that. Yes i have done a research but the errors seems to be old. i am using IDLE btw.