Fixed FBchatRedirectError

This commit is contained in:
Mads Marquart
2018-06-27 11:07:16 +02:00
parent 637b0ded09
commit 0947e77082
2 changed files with 3 additions and 3 deletions

View File

@@ -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)

View File

@@ -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: