osxstrap.py 文件源码

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

项目:osxstrap 作者: osxstrap 项目源码 文件源码
def get_gh_api():
    if not os.environ.get("OSXSTRAP_GITHUB_USERNAME"):
        username = click.prompt('Please enter your Github username')
        common.set_dotenv_key("OSXSTRAP_GITHUB_USERNAME", username)
    else:
        username = os.environ.get("OSXSTRAP_GITHUB_USERNAME")

    if not os.environ.get("OSXSTRAP_GITHUB_API_TOKEN"):
        token = click.prompt('Please create a Github access token by going to https://github.com/settings/tokens/new?scopes=gist&description=osxstrap+gist+cli and enter it here')
        common.set_dotenv_key("OSXSTRAP_GITHUB_API_TOKEN", token)
    else:
        token = os.environ.get("OSXSTRAP_GITHUB_API_TOKEN")

    gh = login(token=token)
    return gh

    files = {
    config_filename : {
        'content': 'What... is the air-speed velocity of an unladen swallow?'
        }
    }
    gist = gh.create_gist('Answer this to cross the bridge', files, public=False)
    # gist == <Gist [gist-id]>
    print(gist.html_url)
    system_username = common.run('whoami', capture=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号