More detailed logging in fetch_blenderid_user
This commit is contained in:
parent
a938342611
commit
1c6599fc30
@ -209,11 +209,12 @@ def fetch_blenderid_user() -> dict:
|
|||||||
:raises LogoutUser: when Blender ID tells us the current token is
|
:raises LogoutUser: when Blender ID tells us the current token is
|
||||||
invalid, and the user should be logged out.
|
invalid, and the user should be logged out.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import httplib2 # used by the oauth2 package
|
import httplib2 # used by the oauth2 package
|
||||||
|
|
||||||
|
my_log = log.getChild('fetch_blenderid_user')
|
||||||
|
|
||||||
bid_url = '%s/api/user' % blender_id_endpoint()
|
bid_url = '%s/api/user' % blender_id_endpoint()
|
||||||
log.debug('Fetching user info from %s', bid_url)
|
my_log.debug('Fetching user info from %s', bid_url)
|
||||||
|
|
||||||
credentials = current_app.config['OAUTH_CREDENTIALS']['blender-id']
|
credentials = current_app.config['OAUTH_CREDENTIALS']['blender-id']
|
||||||
oauth_token = session['blender_id_oauth_token']
|
oauth_token = session['blender_id_oauth_token']
|
||||||
@ -226,23 +227,23 @@ def fetch_blenderid_user() -> dict:
|
|||||||
try:
|
try:
|
||||||
bid_resp = oauth_session.get(bid_url)
|
bid_resp = oauth_session.get(bid_url)
|
||||||
except httplib2.HttpLib2Error:
|
except httplib2.HttpLib2Error:
|
||||||
log.exception('Error getting %s from BlenderID', bid_url)
|
my_log.exception('Error getting %s from BlenderID', bid_url)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
if bid_resp.status_code == 403:
|
if bid_resp.status_code == 403:
|
||||||
log.warning('Error %i from BlenderID %s, logging out user', bid_resp.status_code, bid_url)
|
my_log.warning('Error %i from BlenderID %s, logging out user', bid_resp.status_code, bid_url)
|
||||||
raise LogoutUser()
|
raise LogoutUser()
|
||||||
|
|
||||||
if bid_resp.status_code != 200:
|
if bid_resp.status_code != 200:
|
||||||
log.warning('Error %i from BlenderID %s: %s', bid_resp.status_code, bid_url, bid_resp.text)
|
my_log.warning('Error %i from BlenderID %s: %s', bid_resp.status_code, bid_url, bid_resp.text)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
payload = bid_resp.json()
|
payload = bid_resp.json()
|
||||||
if not payload:
|
if not payload:
|
||||||
log.warning('Empty data returned from BlenderID %s', bid_url)
|
my_log.warning('Empty data returned from BlenderID %s', bid_url)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
log.debug('BlenderID returned %s', payload)
|
my_log.debug('BlenderID returned %s', payload)
|
||||||
return payload
|
return payload
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user