Once github2 is installed we can open an interactive Python session and perform some basic tasks to familiarise ourselves with the package.
Create an unauthenticated client object:
>>> from github2.client import Github
>>> github = Github()
Note
Creating an unauthenticated client object means we can play with the API without fear of creating or deleting data on our account.
See how many followers the github2 project has:
>>> len(github.repos.watchers("ask/python-github2"))
129
Read the description of the python-github2 project:
>>> repo = github.repos.show("ask/python-github2")
>>> repo.description
u'github client in python, with issues support.'
We can take advantage of Python’s dir() to explore the package a little more:
>>> filter(lambda s: not s.startswith("_"), dir(github.users))
['domain', 'follow', 'followers', 'following', 'get_value', 'get_values',
'make_request', 'request', 'search', 'search_by_email', 'show',
'unfollow']
For more information on specific functionality see the API documentation, and the copious examples contained within.