【问题标题】:github repos with all details包含所有详细信息的 github 存储库
【发布时间】:2019-09-02 16:28:39
【问题描述】:

下面的代码将列出我所有的回购。但是有没有办法再添加 3 列来包括创建日期、语言和类型(例如 Sources / Forks)?我正在使用 PyGithub 包。

from github import Github
g = Github("user_name", "passwd")
for repo in g.get_user().get_repos():
    print(repo.name)

【问题讨论】:

  • Github 是什么包? PyPl 上有很多名字相似的东西。
  • 点安装 PyGithub

标签: python github-api


【解决方案1】:

Repository class 确实有(假设 PyGithub/PyGithub

所以你可以使用这些属性和print them in column,使用format string(Python 2.6+,如seen here

for repo in g.get_user().get_repos():
    print("{: >20} {: >20} {: >20}  {: >20}".format(repo.name, repo.language, repo.created_at, repo.fork))

【讨论】:

  • 我有点(或很多)尴尬地说我无法使用这个答案中提到的课程。举个例子会很有用。
  • 知道了。谢谢!
  • @shantanuo 太好了! github.com/PyGithub/PyGithub/blob/… 的示例
  • 当我尝试这个(使用我的凭据)时,我得到 GitHubException 401 "Requires authentication"
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多