【问题标题】:Creating Gist with PyGithub使用 PyGithub 创建 Gist
【发布时间】:2019-05-28 14:32:25
【问题描述】:

有没有使用 PyGithub 创建新 Gist 的选项?

GitHub上有这样的API option,但PyGithub中似乎没有。

【问题讨论】:

    标签: python pygithub


    【解决方案1】:

    使用Github.get_user,后跟AuthenticatedUser.create_gist

    gh = github.Github("auth token")
    gh_auth_user = gh.get_user()
    gist = gh_auth_user.create_gist(public=False, files={"myfile.txt": github.InputFileContent("my contents")}, description="my description")
    

    【讨论】:

    • 您是否知道如何更新现有的 gist?
    • Gist 是一个 git 存储库。创建后我在本地克隆它,然后像使用常规 git repo 一样使用它。
    猜你喜欢
    • 1970-01-01
    • 2013-09-11
    • 2019-05-08
    • 2015-04-24
    • 2017-07-15
    • 2020-07-04
    • 1970-01-01
    • 1970-01-01
    • 2018-08-28
    相关资源
    最近更新 更多