Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Python library implementing the GitHub API v3
Python

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
doc
github
.gitignore
.travis.yml
COPYING
COPYING.LESSER
Contributing.md
ReadMe.md
publish.sh
python25-requirements.txt
setup.py

ReadMe.md

This is a Python (2 and 3) library to access the Github API v3.

With it, you can manage your Github resources (repositories, user profiles, organizations, etc.) from Python scripts.

It covers the full API, and all methods are tested against the real Github site.

Should you have any question, or if you find a bug, or if there is something you can do with the API but not with PyGithub, please open an issue.

PyGithub is stable. I will maintain it up to date with the API, and fix bugs if any, but I don't plan new heavy developments.

What's new?

Build Status

Version 1.10.0 (December 25th, 2012) (Christmas 2012 edition)

  • Major improvement: support Python 3! PyGithub is automaticaly tested on Travis with versions 2.5, 2.6, 2.7, 3.1 and 3.2 of Python
  • Add a shortcut function Github.get_repo to get a repo directly from its full name. thank you lwc for the contribution
  • Github.get_gitignore_templates and Github.get_gitignore_template for APIs /gitignore/templates
  • Add the optional ref parameter to Repository.get_contents and get_readme. Thank you fixxxeruk for the contribution
  • Get comments for all issues and all pull requests on a repository (GET /repos/:user/:repo/pulls/comments: Repository.get_pulls_comments or Repository.get_pulls_review_comments; GET /repos/:user/:repo/issues/comments: Repository.get_issues_comments)

Previous versions

See ChangeLog.

Download and install

This package is in the Python Package Index, so easy_install PyGithub or pip install PyGithub should be enough. You can also clone it on Github.

Tutorial

First create a Github instance:

from github import Github

g = Github( "user", "password" )

Then play with your Github objects:

for repo in g.get_user().get_repos():
    print repo.name
    repo.edit( has_wiki = False )

You can also create a Github instance with an OAuth token:

g = Github( token )

Or without authentication:

g = Github()

Reference documentation

You need to use a Github API and wonder which class implements it? Reference of APIs

You want all the details about PyGithub classes? Reference of classes

Licensing

PyGithub is distributed under the GNU Lesser General Public Licence. See files COPYING and COPYING.LESSER, as requested by GNU.

Projects using PyGithub

(Open an issue if you want to be listed here, I'll be glad to add your project)

They talk about PyGithub

Something went wrong with that request. Please try again.