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

Release v.

github4.py is wrapper for the GitHub API written in python. The design of github4.py is centered around having a logical organization of the methods needed to interact with the API. As an example, let’s get information about a user:

from github4 import login

gh = login('staticdev', password='<password>')

staticdev = gh.me()
# <AuthenticatedUser [staticdev:Thiago Carvalho D'Ávila]>

print(staticdev.name)
# Thiago Carvalho D'Ávila
print(staticdev.login)
# staticdev
print(staticdev.followers_count)
# 4

for f in gh.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) for f in gh.followers('kennethreitz')]

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

Installation

$ pip install github4.py