From 0947e77082d14ac9dc285fd766190a9c33648ce9 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 27 Jun 2018 11:07:16 +0200 Subject: [PATCH] Fixed `FBchatRedirectError` --- fbchat/models.py | 2 +- fbchat/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fbchat/models.py b/fbchat/models.py index d6036dc..a1b2f35 100644 --- a/fbchat/models.py +++ b/fbchat/models.py @@ -25,7 +25,7 @@ class FBchatRedirectError(Exception): #: The url that Facebook redirected to fb_redirect_url = None def __init__(self, message, fb_redirect_url=None): - super(FBchatFacebookError, self).__init__(message) + super(FBchatException, self).__init__(message) """Thrown by fbchat when Facebook returns an unexpected redirect""" self.fb_redirect_url = str(fb_redirect_url) diff --git a/fbchat/utils.py b/fbchat/utils.py index 57412f7..8c8fc08 100644 --- a/fbchat/utils.py +++ b/fbchat/utils.py @@ -187,10 +187,10 @@ def generateOfflineThreadingID(): return str(int(msgs, 2)) def check_json(j): - if j.get('jsmods') is not None and j['jsmods'].get('require') is not None: + if not j.get('payload') and j.get('jsmods') is not None and j['jsmods'].get('require') is not None: for x in j['jsmods']['require']: if len(x) > 3 and x[0] == 'ServerRedirect' and x[1] == 'redirectPageTo': - return FBchatRedirectError('Redicrect when sending request: {}'.format(j), fb_redirect_url=x[3][0]) + return FBchatRedirectError('Redirect when sending request: {}'.format(j), fb_redirect_url=x[3][0]) if j.get('error') is None: return if 'errorDescription' in j: