fix: exception handling when timeout (#22)
This commit is contained in:
parent
b6d20406f8
commit
f351e73844
6
api.py
6
api.py
@ -10,7 +10,11 @@ CORS(app, resources={r"/.*": {"origins": ["https://course.snsd0805.com"]}})
|
||||
def facebookAuth(token):
|
||||
url = "https://graph.facebook.com/v9.0/me?access_token={}"
|
||||
|
||||
response = requests.get(url.format(token), timeout=3)
|
||||
try:
|
||||
response = requests.get(url.format(token), timeout=5)
|
||||
except:
|
||||
return False, None, None
|
||||
else:
|
||||
data = json.loads(response.text)
|
||||
|
||||
# 若 access code 通過 facebook 驗證
|
||||
|
||||
Loading…
Reference in New Issue
Block a user