Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibly fixes #175, added custom Exception classes #201

Merged
merged 7 commits into from
Sep 25, 2017
Merged

Possibly fixes #175, added custom Exception classes #201

merged 7 commits into from
Sep 25, 2017

Conversation

madsmtm
Copy link
Member

@madsmtm madsmtm commented Sep 19, 2017

#175 (502 response):
You would get either a 502 or a 503 response from Facebook's pull-servers once in a while.
Proposed fix is to change the pull-channel, and refresh the self.sticky/self.pool parameters.

I don't quite remember my tests, but I'm pretty sure that refreshing the sticky/pool parameters were nescessary. I'm not sure I actually double-checked that changing the pull-channel was nescessary, but it's something that I've noticed the Facebook-webclient does.

Other than that:

  • The default doOneListen loop has been improved.
  • Added custom exceptions FBchatException, FBchatFacebookError and FBchatUserError
  • Using the custom exceptions, this fixes the "Please try closing and re-opening your browser window" error
  • Changed ReqUrl to self.req_url, so that we can change pull channels

This is still untested for long amounts of time, will do that before merging

Added `FBchatException`, `FBchatFacebookError` and `FBchatUserError`, which can help in differentiating between errors
Requests would sometimes throw an error while retrieving the c_user cookie (If there were multiple cookies with this name)
Thereby also moving ReqUrl to self.req_url
@@ -157,11 +199,14 @@ def _postLogin(self):
self.payloadDefault = {}
self.client_id = hex(int(random()*2147483648))[2:]
self.start_time = now()
self.uid = str(self._session.cookies['c_user'])
self.uid = self._session.cookies.get_dict().get('c_user')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would probably also fix #198, since requests.session.cookies works kinda wierd

@madsmtm madsmtm merged commit c00b3df into fbchat-dev:master Sep 25, 2017
@madsmtm madsmtm deleted the improved-stability branch October 21, 2017 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant