Github API for Python : PyGithub – get a list of all commits for a particular repository

I am developing a script which requires me to get a list of all commits for a particular repository, as well as the date and time of commit. The Commit Class in the PyGithub API:

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

  • Failed patch changed my Git Bash prompt, how do I revert it?
  • Git merge changes between two specific commits from another branch
  • push to remote repo gives the error - there are still refs under
  • How can Jenkins poll on a specific file and not the whole repo
  • IntelliJ change markers reflecting local changes instead of VCS changes?
  • restore windows command prompt tools after git bash replace them with unix tools
  • does not have any member for date-of-commit and time-of-commit.
    Any ideas on how to get the date and time of a commit using the API?

  • Git squash commits with merged branch
  • Git pull for all branches in local repository
  • Remove trailing whitespace on save in Intellij Idea (12)
  • Difference between Gitbash and Sourcetree app terminal
  • Git Branching and Environment Deployment Tracking
  • GitHub OAuth2 Token: How to restrict access to read a single private repo
  • 2 Solutions collect form web for “Github API for Python : PyGithub – get a list of all commits for a particular repository”

    A bit late to answer, but you can get the information from the GitAuthor of the GitCommit of the Commit.
    This will print the dates of all the commits:

    for commit in commits:
        if commit.commit is not None:
            print commit.commit.author.date
    

    I think you need to call

    commit.getStatuses()
    

    and in each satsus there is attributes created_at and updated_at

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

    Class CommitStatus

    Attributes:

    • created_at: datetime.datetime
    • creator: NamedUser
    • description: string
    • id: integer
    • state: string
    • target_url: string
    • updated_at: datetime.datetime
    Git Baby is a git and github fan, let's start git clone.