From b35240bddace371ddbefa088c59bc1a87c6d4196 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Sun, 7 Jun 2020 12:35:07 +0200 Subject: [PATCH] Handle locked accounts --- fbchat/_session.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fbchat/_session.py b/fbchat/_session.py index d8729a4..d76086e 100644 --- a/fbchat/_session.py +++ b/fbchat/_session.py @@ -154,6 +154,10 @@ def two_factor_helper(session: requests.Session, r, on_2fa_callback): log.debug("2FA location: %s", r.headers.get("Location")) url, data = find_form_request(r.content.decode("utf-8")) + if "verification_method" in data: + raise _exception.NotLoggedIn( + "Your account is locked, and you need to log in using a browser, and verify it there!" + ) if "submit[This was me]" not in data or "submit[This wasn't me]" not in data: raise _exception.ParseError("Could not fill out form properly (2)", data=data) data["submit[This was me]"] = "[any value]"