Skip to content
Python library for interfacing with the GitHub APIv3
Python Jupyter Notebook
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
github3
requests @ 2d97466
tests
.gitignore
.gitmodules
.travis.yml
HISTORY.rst
LICENSE
MANIFEST.in
README.rst
TODO.rst
setup.py

README.rst

github3.py

Eventually this will be a python module to access the GitHub v3 API.

Easy Cloning

Assuming you have git 1.7.x (although I'm not entirely certain what version it was introduced in) you can perform git clone --recursive git://github.com/sigmavirus24/github3.py.git github3.py to clone this and the submodule at the same time. Otherwise you have to do:

$ git clone git://github.com/sigmavirus24/github3.py.git
$ cd github3.py
$ git submodule init
$ git submodule update

Dependencies

Progress

License

Modified BSD license

Examples

>>> from github3 import login
>>> gh = login(username, password)
>>> gists = gh.list_gists()
>>> files = {'spam.txt' : {'content': 'What... is the air-speed velocity of an
unladen swallow?'}}
>>> gh.create_gist('Answer this to cross the bridge', files, public=False)
<Gist [gist-id]>
>>> from github3 import create_gist
>>> files = {'spam.txt' : {'content': 'What... is the air-speed velocity of an
unladen swallow?'}}
>>> gist = create_gist('Answer this to cross the bridge', files, public=False)
>>> gist.list_comments()
[]
>>> gist.create_comment('Bogus. This will not work.')
# Which of course it didn't, because you're not logged in
>>> from github3 import login
>>> gh = login(username, password)
>>> issue = gh.issue('sigmavirus24', 'issues.py', 2)
>>> issue.html_url
u'https://github.com/sigmavirus24/issues.py/issues/2'
>>> issue.state
u'open'
>>> issue.close()
True
>>> issue.reopen()
True
>>> issue.edit('Testing Github3.py', 'Testing re-opening', 'sigmavirus24')
True
>>> from github3 import login
>>> gh = login(username, password)
>>> issue = gh.issue('sigmavirus24', 'Todo.txt-python', 17)
>>> issue.html_url
u'https://github.com/sigmavirus24/Todo.txt-python/issues/17'
>>> issue.state
u'open'
>>> events = issue.list_events()
>>> events
[<Issue Event [#17 - subscribed - sigmavirus24]>, <Issue Event [#17 - assigned - sigmavirus24]>,
 <Issue Event [#17 - referenced - sigmavirus24]>]
>>> events[0].actor
<User [sigmavirus24:None]>
>>> events[0].issue
<Issue [sigmavirus24/Todo.txt-python #17]>
>>> events[0].closed_at
>>> events[0].event
u'subscribed'
>>> from github3 import login
>>> g = login(username, password)
>>> repo = g.repository('sigmavirus24', 'Todo.txt-python')
>>> sha = repo.create_blob('Testing blob creation', 'utf-8')
>>> sha
u'57fad9a39b27e5eb4700f66673ce860b65b93ab8'
>>> blob = repo.blob(sha)
>>> blob.content
u'VGVzdGluZyBibG9iIGNyZWF0aW9u\n'
>>> blob.decoded
u'Testing blob creation'
>>> blob.encoding
u'base64'

Author

Sigmavirus24

Something went wrong with that request. Please try again.