【问题标题】:github3.py doesn't return file content for gistgithub3.py 不返回 gist 的文件内容
【发布时间】:2015-04-16 23:08:23
【问题描述】:

我使用 github3.py 库在 github.com 上创建和更新 Gist

我可以访问现有的 gist 并获取除文件内容之外的所有信息:

for g in gh.iter_gists():
    if g.id == content[0]:
        f = g.iter_files().next()
        print g.files #1
        print f.raw_url
        old_content = f.content #Returns None

任何提示为什么它在最后一行返回None

【问题讨论】:

    标签: github3.py


    【解决方案1】:

    看起来 GitHub 的 API 不再将 gist 文件的内容作为响应的一部分返回:

    {u'size': 12, u'raw_url': u'https://gist.githubusercontent.com/testgh3/eb911d34ec732e4b7f24/raw/e041e7dc6236db21062c11b2929a72e656bbc40e/fileA.txt', u'type': u'text/plain', u'language': u'Text', u'filename': u'fileA.txt'}
    

    这意味着您在这里尝试使用的 github3.py needs to add functionality to the GistFile class。 (我已经为此创建了一个问题。如果您愿意帮助完成这项工作,我很乐意为您提供帮助,并且我很乐意将拉取请求与此功能合并。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-27
      • 2019-06-24
      • 2014-05-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-03
      相关资源
      最近更新 更多