def read_user_from_github(username=None):
"""
Read user information from github
:param username: Optional username to search for, if no username given the
currently logged in user will be returned (if any)
:returns: Dict of information from github API call
"""
if username is not None:
url = 'users/%s' % (username)
else:
url = 'user'
app.logger.debug('GET: %s', url)
resp = github.get(url)
if resp.status != 200:
log_error('Failed reading user', url, resp)
return {}
return resp.data
评论列表
文章目录