remote.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:guides-cms 作者: pluralsight 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号