From 9209f8a462457cdb2c07b840c20e82d29f43e8b1 Mon Sep 17 00:00:00 2001 From: bertolla Date: Thu, 11 Jun 2020 21:14:30 +0200 Subject: [PATCH] retrieve access token from headers --- fb_auth_token.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fb_auth_token.py b/fb_auth_token.py index ed2fcdf..fcede72 100644 --- a/fb_auth_token.py +++ b/fb_auth_token.py @@ -22,6 +22,10 @@ def get_fb_access_token(email, password): access_token = re.search( r"access_token=([\w\d]+)", s.response.content.decode()).groups()[0] return access_token + except requests.exceptions.InvalidSchema as browserAddress: + access_token = re.search( + r"access_token=([\w\d]+)",str(browserAddress)).groups()[0] + return access_token except Exception as ex: print("access token could not be retrieved. Check your username and password.") print("Official error: %s" % ex)