Skip to content

Commit

Permalink
Fix "Got empty response when trying to check login"
Browse files Browse the repository at this point in the history
Fixes mautrix/facebook#109

Seems like trying to hit `/` results in a 302 redirect,
leading me to some chat (https://www.messenger.com/t/XXXXXXXX/).

Allowing redirects seems to make the bridge work again.

I guess this potentially makes the `if len(html) == 0` check (below) potentially
useless, since it's now unlikely to receive an empty response.
  • Loading branch information
spantaleev authored Dec 1, 2020
1 parent 9ff0d51 commit 3978c1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fbchat/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ async def _from_session(cls, session: aiohttp.ClientSession, domain: str

# Make a request to the main page to retrieve ServerJSDefine entries
try:
r = await session.get(prefix_url(domain, "/"), allow_redirects=False, headers={
r = await session.get(prefix_url(domain, "/"), allow_redirects=True, headers={
"Accept": "text/html",
})
except aiohttp.ClientError as e:
Expand Down

0 comments on commit 3978c1b

Please sign in to comment.