我查看了文档,甚至源代码,我似乎找不出如何使用github3.py库获得提交的时间戳。我很确定它在那里是因为,这是个时间戳。
发布于 2019-02-05 19:59:08
因此,如果您想获得一个与存储在GitHub中的git提交相关的时间戳,那么您需要做一些事情:
因此,如果您拥有存储库,您将按如下方式检索它:
repo = github3.repository('username', 'repositoryname')这样,您应该能够获得如下所示的git_commit数据:
commit = repo.git_commit('sha1-of-git-commit-i-care-about')您的commit值是一个github3.git.Commit对象的实例,该对象具有author和committer属性,这些属性是类似于
"author": {
"date": "2014-11-07T22:01:45Z",
"name": "Scott Chacon",
"email": "schacon@gmail.com"
},
"committer": {
"date": "2014-11-07T22:01:45Z",
"name": "Scott Chacon",
"email": "schacon@gmail.com"
},所以你可以用以下方式来结束这个过程:
commit.author["date"]我建议使用像dateutil这样的实用工具来解析这些时间戳。
https://stackoverflow.com/questions/54523188
复制相似问题