PyGitHub

Let's look at using the PyGitHub package, http://pygithub.readthedocs.io/en/latest/, to interact with GitHub repositories. The package is a wrapper around GitHub APIv3, https://developer.github.com/v3/:

$ sudo pip install pygithub$ sudo pip3 install pygithub

Let's use the Python shell to print out the user's current repository:

$ python3>>> from github import Github>>> g = Github("ericchou1", "<password>")>>> for repo in g.get_user().get_repos():...     print(repo.name)...ansible...-Hands-on-Network-Programming-with-PythonMastering-Python-NetworkingMastering-Python-Networking-Second-Edition>>>

For more programmatic access, we can also create more granular control using an access token. Github allows a token to be associated with the ...

Get Mastering Python Networking - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.