fbchat-dev / fbchat

Facebook Chat (Messenger) for Python
https://fbchat.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.19k stars 412 forks source link

Time out connection issue #191

Closed jig4physics closed 4 years ago

jig4physics commented 7 years ago

hi, I am using python 2.7, fbchat-1.0.18 (using folder not pip install) and echo.py. At very first time client was working fine and suddenly its started firing error of time out. after that it stated error of time out. during login. here is the info.

Traceback (most recent call last): File "echo.py", line 16, in client = EchoBot("MyEmail@emai.com", "Password") File "/home/scott/Desktop/FbChatBot/fbchat/client.py", line 73, in init self.login(email, password, max_tries) File "/home/scott/Desktop/FbChatBot/fbchat/client.py", line 336, in login login_successful, login_url = self._login() File "/home/scott/Desktop/FbChatBot/fbchat/client.py", line 198, in _login soup = bs(self._get(ReqUrl.MOBILE).text, "lxml") File "/home/scott/Desktop/FbChatBot/fbchat/client.py", line 96, in _get return self._session.get(url, headers=self._header, params=payload, timeout=timeout) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 526, in get return self.request('GET', url, kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 513, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 663, in send r.content File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 817, in content self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes() File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 746, in generate raise ConnectionError(e) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='m.facebook.com', port=443): Read timed out.

after trying for several time my mobile "messenger" gets log out every time.

Bankde commented 7 years ago

Very interesting, look alike #187 but this happened in echo.py

@madsmtm According to this issue, #187 #175 I believe there are 2 different issues lying here.

  1. Listening for long time, #175
  2. Login issue (doesn't have to wait for long time), this one and #187 Login issue probably come from some different security settings.

Thank you for reporting, I believe this is very useful. By the way, do you have some security setting turn on ? Like Two-factor authen or Profile picture login, etc

Bankde commented 7 years ago

I have tested this for almost week.

fb_dtsg doesn't update, sendMessage already start giving error 4 days ago. Listening is still working fine. isLogin is still working fine. I didn't open listening for whole week though, only tried once a day then saved vm state.

I don't think both issues are about session. For listening issue, probably real connection issue, I will find other way to test. Still no idea for login issue.

madsmtm commented 4 years ago

I'll close this, as it's probably not relevant anymore