Skip to content

Commit

Permalink
Fixed login for issue fbchat-dev#625
Browse files Browse the repository at this point in the history
Facebook changed response format. ServerJSDefine is no longer in it.
  • Loading branch information
maraid committed Dec 21, 2020
1 parent 916a140 commit 7aa2dfb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fbchat/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@


SERVER_JS_DEFINE_REGEX = re.compile(
r'(?:"ServerJS".{,100}\.handle\({.*"define":)|(?:require\("ServerJSDefine"\)\)?\.handleDefines\()'
r'(?:"ServerJS".{,100}\.handle\({.*"define":)'
r'|(?:ServerJS.{,100}\.handleWithCustomApplyEach\(ScheduledApplyEach,{.*"define":)'
r'|(?:require\("ServerJSDefine"\)\)?\.handleDefines\()'
)
SERVER_JS_DEFINE_JSON_DECODER = json.JSONDecoder()

Expand Down Expand Up @@ -411,7 +413,7 @@ def _from_session(cls, session):

# Make a request to the main page to retrieve ServerJSDefine entries
try:
r = session.get(prefix_url("/"), allow_redirects=False)
r = session.get(prefix_url("/"), allow_redirects=True)
except requests.RequestException as e:
_exception.handle_requests_error(e)
_exception.handle_http_error(r.status_code)
Expand Down

0 comments on commit 7aa2dfb

Please sign in to comment.