github.py 文件源码

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

项目:django-chartwerk 作者: DallasMorningNews 项目源码 文件源码
def get_repository():
    """Get the GitHub repo specified in settings or the default.

    If the repo doesn't exist, try to create it.
    """
    try:
        g = Github(**get_github_credentials())

        if app_settings.GITHUB_ORG:
            user = g.get_organization(app_settings.GITHUB_ORG)
        else:
            user = g.get_user()

        try:
            return user.get_repo(app_settings.GITHUB_REPO)
        except UnknownObjectException:
            logging.info("Creating repository {}".format(
                app_settings.GITHUB_REPO
            ))
            return user.create_repo(app_settings.GITHUB_REPO)
    except GithubException:
        logging.exception("Unable to configure Github connection.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号