I looked through the documentation and even the source code and I can't seem to figure out how to get the timestamp of a commit using the github3.py library. I'm, pretty sure it's there because, well, it's a timestamp.
So if you want to get a timestamp that's related to a git commit stored in GitHub, then you'll need to have a few things:
So if you have the repository you'd retrieve it like so:
repo = github3.repository('username', 'repositoryname')
With that, you should be able to get the git_commit
data like so:
commit = repo.git_commit('sha1-of-git-commit-i-care-about')
Your commit
value is an instance of a github3.git.Commit
object which has author
and committer
attributes which are dictionaries that look like
"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"
},
So you can wrap this up with:
commit.author["date"]
I suggest using a utility like dateutil
to parse these timestamps.