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)
评论列表
文章目录