2013-02-16 106 views
3

我正在開發一個腳本,它需要我獲取特定存儲庫的所有提交列表以及提交日期和時間。在PyGithub API在提交類別:Python的Github API:PyGithub - 獲取特定存儲庫的所有提交列表

https://github.com/jacquev6/PyGithub/blob/master/doc/ReferenceOfClasses.md#class-commit

沒有對日期的提交和時間的提交任何成員。 關於如何使用API​​獲取提交日期和時間的任何想法?

+0

這是一個問題?我不這麼認爲。 – 2013-02-16 10:09:00

回答

0

我認爲你需要調用

commit.getStatuses() 

,並在每個satsus有屬性created_at的updated_at

從這裏:https://github.com/jacquev6/PyGithub/blob/master/doc/ReferenceOfClasses.md#class-commitstatus

類CommitStatus

屬性:

  • created_at:datetime.datetime
  • 創作者:NamedUser
  • 描述:串
  • ID:整數
  • 狀態:串
  • target_url:串
  • 的updated_at:datetime.datetime
+0

我想知道這個,但爲什麼每個提交會有多個'CommitStatus'? – wrgrs 2013-02-16 12:41:21

+0

@wrgrs不知道,但提交類中沒有getStatus函數... – ndpu 2013-02-16 13:26:41

+0

@wrgrs是不是因爲您可以修改提交併再次推送更改? (甚至做一個rebase) – SummerBreeze 2013-02-28 08:10:43

1

有點晚t o回答,但您可以從Commit的GitCommitGitAuthor獲得信息。 這將打印所有提交的日期:

for commit in commits: 
    if commit.commit is not None: 
     print commit.commit.author.date 
相關問題