This is a Python 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.
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.
First create a Gihtub 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()
PyGithub is distributed under the GNU Lesser General Public Licence. See files COPYING and COPYING.LESSER, as requested by GNU.
(Open an issue if you want to be listed here, I'll be glad to add your project)
- Upverter is a web-based schematic capture and PCB layout tool for people who design electronics. Designers can attach a Github project to an Upverter project.
- Tratihubis converts Trac tickets to Github issues
Version 1.6 (September 8th, 2012)
- Restore support for Python 2.5
- Implement new APIS:
- /hooks (undocumented, but mentioned in https://developer.github.com/v3/repos/hooks/#create-a-hook)
- Merging
- Starring and subscriptions
- Assignees
- Commit statuses
- Contents, thank you berndca for asking
- Clarify issue and review comments on PullRequest, thank you nixoz2k7 for asking
Version 1.5 (September 5th, 2012)
- Add a timeout option, thank you much xobb1t for the merge request. This drops Python 2.5 support. I may be able to restore it in next version.
- Implement
Repository.delete
, thank you pmchen for asking
Version 1.4 (August 4th, 2012)
- Allow connection to a custom Github URL, for Github Enterprise, thank you very much engie for the merge request
Version 1.3 (July 13th, 2012)
- Implement markdown rendering
GitAuthor.date
is now a datetime, thank you bilderbuchi- Fix documentation of
Github.get_gist
:id
is a string, not an integer
Version 1.2 (June 29th, 2012)
- Implement legacy search APIs, thank you kukuts for telling me Github had released them
- Fix a bug with issue labels containing spaces, thank you philipkimmey for detecting the bug and fixing it
- Clarify how collections of objects are returned by
get_*
methods, thank you bilderbuchi for asking
- Restore compatibility with Python 2.5, thank you pmuilu
- Use
package_data
instead ofdata_files
for documentation files insetup.py
, thank you malexw for reporting
Version 1.0 (June 3rd, 2012)
- Complete rewrite, with no more complicated meta-description
- Full typing of attributes and parameters
- Full documentation of attributes and parameters
- More usable exceptions raised in case on problems with the API
- Some bugs and limitations fixed, special thanks to bilderbuchi, roskakori and tallforasmurf for reporting them!
Version 0.7 (May 26th, 2012)
- Use PyGithub with OAuth authentication or with no authentication at all
Version 0.6 (April 17th, 2012)
- Fix issue 21 (KeyError when accessing repositories)
- Re-completed the API with NamedUser.create_gist
Version 0.5 (March 19th, 2012)
- Major achievement: all APIs are implemented
- More refactoring, of course
Version 0.4 (March 12th, 2012)
- The list of the not implemented APIs is shorter than the list of the implemented APIs
- APIs not implemented:
- GET
/gists/public
- GET
/issues
- GET
/repos/:user/:repo/compare/:base...:head
- GET
/repos/:user/:repo/git/trees/:sha?recursive=1
- POST
/repos/:user/:repo/git/trees?base_tree=
- GET
- Gists
- Autorizations
- Keys
- Hooks
- Events
- Merge pull requests
- More refactoring, one more time
- More refactoring
- Issues, milestones and their labels
- NamedUser:
- emails
- Repository:
- downloads
- tags, branches, commits and comments (not the same as "Git objects" of version 0.2)
- pull requests (no automatic merge yet)
- Automatic generation of the reference documentation of classes, with less "see API"s, and less errors
- Refactoring
- Teams details and modification
- basic attributes
- list teams in organizations, on repositories
- Git objects
- create and get tags, references, commits, trees, blobs
- list and edit references
- User details and modification
- basic attributes
- followers, following, watching
- organizations
- repositories
- Repository details and modification
- basic attributes
- forking
- collaborators, contributors, watchers
- Organization details and modification
- basic attributes
- members and public members