How to retrieve all of the public repositories on GitHub


In [1]:
import github3

In [3]:
for repository in github3.all_repositories(number=50):
    print('{0}, id: {0.id}, url: {0.html_url}'.format(repository))


mojombo/grit, id: 1, url: https://github.com/mojombo/grit
wycats/merb-core, id: 26, url: https://github.com/wycats/merb-core
rubinius/rubinius, id: 27, url: https://github.com/rubinius/rubinius
mojombo/god, id: 28, url: https://github.com/mojombo/god
vanpelt/jsawesome, id: 29, url: https://github.com/vanpelt/jsawesome
wycats/jspec, id: 31, url: https://github.com/wycats/jspec
defunkt/exception_logger, id: 35, url: https://github.com/defunkt/exception_logger
defunkt/ambition, id: 36, url: https://github.com/defunkt/ambition
technoweenie/restful-authentication, id: 42, url: https://github.com/technoweenie/restful-authentication
technoweenie/attachment_fu, id: 43, url: https://github.com/technoweenie/attachment_fu
topfunky/bong, id: 47, url: https://github.com/topfunky/bong
Caged/microsis, id: 48, url: https://github.com/Caged/microsis
anotherjesse/s3, id: 52, url: https://github.com/anotherjesse/s3
anotherjesse/taboo, id: 53, url: https://github.com/anotherjesse/taboo
anotherjesse/foxtracs, id: 54, url: https://github.com/anotherjesse/foxtracs
anotherjesse/fotomatic, id: 56, url: https://github.com/anotherjesse/fotomatic
mojombo/glowstick, id: 61, url: https://github.com/mojombo/glowstick
defunkt/starling, id: 63, url: https://github.com/defunkt/starling
wycats/merb-more, id: 65, url: https://github.com/wycats/merb-more
macournoyer/thin, id: 68, url: https://github.com/macournoyer/thin
jamesgolick/resource_controller, id: 71, url: https://github.com/jamesgolick/resource_controller
jamesgolick/markaby, id: 73, url: https://github.com/jamesgolick/markaby
jamesgolick/enum_field, id: 74, url: https://github.com/jamesgolick/enum_field
defunkt/subtlety, id: 75, url: https://github.com/defunkt/subtlety
defunkt/zippy, id: 92, url: https://github.com/defunkt/zippy
defunkt/cache_fu, id: 93, url: https://github.com/defunkt/cache_fu
KirinDave/phosphor, id: 95, url: https://github.com/KirinDave/phosphor
bmizerany/sinatra, id: 98, url: https://github.com/bmizerany/sinatra
jnewland/gsa-prototype, id: 102, url: https://github.com/jnewland/gsa-prototype
technoweenie/duplikate, id: 105, url: https://github.com/technoweenie/duplikate
jnewland/lazy_record, id: 118, url: https://github.com/jnewland/lazy_record
jnewland/gsa-feeds, id: 119, url: https://github.com/jnewland/gsa-feeds
jnewland/votigoto, id: 120, url: https://github.com/jnewland/votigoto
defunkt/mofo, id: 127, url: https://github.com/defunkt/mofo
jnewland/xhtmlize, id: 129, url: https://github.com/jnewland/xhtmlize
schacon/ruby-git, id: 130, url: https://github.com/schacon/ruby-git
ezmobius/bmhsearch, id: 131, url: https://github.com/ezmobius/bmhsearch
uggedal/mofo, id: 137, url: https://github.com/uggedal/mofo
mmower/simply_versioned, id: 139, url: https://github.com/mmower/simply_versioned
abhay/gchart, id: 140, url: https://github.com/abhay/gchart
benburkert/schemr, id: 141, url: https://github.com/benburkert/schemr
abhay/calais, id: 142, url: https://github.com/abhay/calais
mojombo/chronic, id: 144, url: https://github.com/mojombo/chronic
sr/git-wiki, id: 165, url: https://github.com/sr/git-wiki
automatthew/ambitious_activeldap, id: 176, url: https://github.com/automatthew/ambitious_activeldap
queso/signal-wiki, id: 177, url: https://github.com/queso/signal-wiki
drnic/ruby-on-rails-tmbundle, id: 179, url: https://github.com/drnic/ruby-on-rails-tmbundle
danwrong/low-pro-for-jquery, id: 185, url: https://github.com/danwrong/low-pro-for-jquery
wayneeseguin/merb-core, id: 186, url: https://github.com/wayneeseguin/merb-core
sr/dst, id: 190, url: https://github.com/sr/dst

If you omit the number parameter, github3.py will attempt to retrieve all of the public repositories available on GitHub. In order to iterate over all of them in a reasonable amount of time, you should authenticate like so:


In [4]:
gh = github3.login('username', 'password')

In [ ]:
for repository in gh.all_repositories():
    print('{0} - id: {0.id}, url: {0.html_url}'.format(repository))