github3.py: A Library for Using GitHub’s REST API

Release v4.0.1.

github3.py is wrapper for theGitHub API written in python. The design ofgithub3.py is centered around having a logical organization of the methodsneeded to interact with the API. As an example, let’s get information about auser:

fromgithub3importlogingh=login('sigmavirus24',password='<password>')sigmavirus24=gh.me()# <AuthenticatedUser [sigmavirus24:Ian Stapleton Cordasco]>print(sigmavirus24.name)# Ian Stapleton Cordascoprint(sigmavirus24.login)# sigmavirus24print(sigmavirus24.followers_count)# 4forfingh.followers():print(str(f))kennethreitz=gh.user('kennethreitz')# <User [kennethreitz:Kenneth Reitz]>print(kennethreitz.name)print(kennethreitz.login)print(kennethreitz.followers_count)followers=[str(f)forfingh.followers_of('kennethreitz')]

There are several examples of different aspects of using github3.py

Installation

$pipinstallgithub3.py

User Guide

API Reference Documentation

Version History

Contributing

All development happens onGitHub. Please remember to add yourself to thelist of contributors in AUTHORS.rst, especially if you’re going to beworking on the list below.

Contributor Friendly Work

In order of importance:

Documentation

I know I’m not the best at writing documentation so if you want to clarifyor correct something, please do so.

Examples

Have a clever example that takes advantage of github3.py? Feel free toshare it.

Otherwise, feel free to example the list of issues where we would likehelpand feel free to take one.

Running the Unittests

The tests are generally run using tox. Tox can be installed like so

pip install tox

We test against PyPy3 and the following versions of Python:

  • 3.7

  • 3.8

  • 3.9

If you simply runtox it will run tests against all of these versions ofpython and runflake8 against the codebase as well. If you want to runagainst one specific version, you can do

tox -e py39

And if you want to run tests against a specific file, you can do

tox -e py39 -- tests/unit/test_github.py

To run the tests,tox usespy.test so you can pass any options orparameters topy.test after specifying--. For example, you can getmore verbose output by doing

tox -e py39 -- -vv

Contact