8000 Add example using all_repositories · qiwsir/github3.py@89a3480 · GitHub
[go: up one dir, main page]

Skip to content

Commit 89a3480

Browse files
committed
Add example using all_repositories
1 parent 5c632eb commit 89a3480

File tree

1 file changed

+132
-0
lines changed

1 file changed

+132
-0
lines changed
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
{
2+
"metadata": {
3+
"name": "",
4+
"signature": "sha256:d7edf60ced4d549568da849ae1760941af6e0432378fa5832cdff325109ee570"
5+
},
6+
"nbformat": 3,
7+
"nbformat_minor": 0,
8+
"worksheets": [
9+
{
10+
"cells": [
11+
{
12+
"cell_type": "heading",
13+
"level": 1,
14+
"metadata": {},
15+
"source": [
16+
"How to retrieve all of the public repositories on GitHub"
17+
]
18+
},
19+
{
20+
"cell_type": "code",
21+
"collapsed": false,
22+
"input": [
23+
"import github3"
24+
],
25+
"language": "python",
26+
"metadata": {},
27+
"outputs": [],
28+
"prompt_number": 1
29+
},
30+
{
31+
"cell_type": "code",
32+
"collapsed": false,
33+
"input": [
34+
"for repository in github3.all_repositories(number=50):\n",
35+
" print('{0}, id: {0.id}, url: {0.html_url}'.format(repository))"
36+
],
37+
"language": "python",
38+
"metadata": {},
39+
"outputs": [
40+
{
41+
"output_type": "stream",
42+
"stream": "stdout",
43+
"text": [
44+
"mojombo/grit, id: 1, url: https://github.com/mojombo/grit\n",
45+
"wycats/merb-core, id: 26, url: https://github.com/wycats/merb-core\n",
46+
"rubinius/rubinius, id: 27, url: https://github.com/rubinius/rubinius\n",
47+
"mojombo/god, id: 28, url: https://github.com/mojombo/god\n",
48+
"vanpelt/jsawesome, id: 29, url: https://github.com/vanpelt/jsawesome\n",
49+
"wycats/jspec, id: 31, url: https://github.com/wycats/jspec\n",
50+
"defunkt/exception_logger, id: 35, url: https://github.com/defunkt/exception_logger\n",
51+
"defunkt/ambition, id: 36, url: https://github.com/defunkt/ambition\n",
52+
"technoweenie/restful-authentication, id: 42, url: https://github.com/technoweenie/restful-authentication\n",
53+
"technoweenie/attachment_fu, id: 43, url: https://github.com/technoweenie/attachment_fu\n",
54+
"topfunky/bong, id: 47, url: https://github.com/topfunky/bong\n",
55+
"Caged/microsis, id: 48, url: https://github.com/Caged/microsis\n",
56+
"anotherjesse/s3, id: 52, url: https://github.com/anotherjesse/s3\n",
57+
"anotherjesse/taboo, id: 53, url: https://github.com/anotherjesse/taboo\n",
58+
"anotherjesse/foxtracs, id: 54, url: https://github.com/anotherjesse/foxtracs\n",
59+
"anotherjesse/fotomatic, id: 56, url: https://github.com/anotherjesse/fotomatic\n",
60+
"mojombo/glowstick, id: 61, url: https://github.com/mojombo/glowstick\n",
61+
"defunkt/starling, id: 63, url: https://github.com/defunkt/starling\n",
62+
"wycats/merb-more, id: 65, url: https://github.com/wycats/merb-more\n",
63+
"macournoyer/thin, id: 68, url: https://github.com/macournoyer/thin\n",
64+
"jamesgolick/resource_controller, id: 71, url: https://github.com/jamesgolick/resource_controller\n",
65+
"jamesgolick/markaby, id: 73, url: https://github.com/jamesgolick/markaby\n",
66+
"jamesgolick/enum_field, id: 74, url: https://github.com/jamesgolick/enum_field\n",
67+
"defunkt/subtlety, id: 75, url: https://github.com/defunkt/subtlety\n",
68+
"defunkt/zippy, id: 92, url: https://github.com/defunkt/zippy\n",
69+
"defunkt/cache_fu, id: 93, url: https://github.com/defunkt/cache_fu\n",
70+
"KirinDave/phosphor, id: 95, url: https://github.com/KirinDave/phosphor\n",
71+
"bmizerany/sinatra, id: 98, url: https://github.com/bmizerany/sinatra\n",
72+
"jnewland/gsa-prototype, id: 102, url: https://github.com/jnewland/gsa-prototype\n",
73+
"technoweenie/duplikate, id: 105, url: https://github.com/technoweenie/duplikate\n",
74+
"jnewland/lazy_record, id: 118, url: https://github.com/jnewland/lazy_record\n",
75+
"jnewland/gsa-feeds, id: 119, url: https://github.com/jnewland/gsa-feeds\n",
76+
"jnewland/votigoto, id: 120, url: https://github.com/jnewland/votigoto\n",
77+
"defunkt/mofo, id: 127, url: https://github.com/defunkt/mofo\n",
78+
"jnewland/xhtmlize, id: 129, url: https://github.com/jnewland/xhtmlize\n",
79+
"schacon/ruby-git, id: 130, url: https://github.com/schacon/ruby-git\n",
80+
"ezmobius/bmhsearch, id: 131, url: https://github.com/ezmobius/bmhsearch\n",
81+
"uggedal/mofo, id: 137, url: https://github.com/uggedal/mofo\n",
82+
"mmower/simply_versioned, id: 139, url: https://github.com/mmower/simply_versioned\n",
83+
"abhay/gchart, id: 140, url: https://github.com/abhay/gchart\n",
84+
"benburkert/schemr, id: 141, url: https://github.com/benburkert/schemr\n",
85+
"abhay/calais, id: 142, url: https://github.com/abhay/calais\n",
86+
"mojombo/chronic, id: 144, url: https://github.com/mojombo/chronic\n",
87+
"sr/git-wiki, id: 165, url: https://github.com/sr/git-wiki\n",
88+
"automatthew/ambitious_activeldap, id: 176, url: https://github.com/automatthew/ambitious_activeldap\n",
89+
"queso/signal-wiki, id: 177, url: https://github.com/queso/signal-wiki\n",
90+
"drnic/ruby-on-rails-tmbundle, id: 179, url: https://github.com/drnic/ruby-on-rails-tmbundle\n",
91+
"danwrong/low-pro-for-jquery, id: 185, url: https://github.com/danwrong/low-pro-for-jquery\n",
92+
"wayneeseguin/merb-core, id: 186, url: https://github.com/wayneeseguin/merb-core\n",
93+
"sr/dst, id: 190, url: https://github.com/sr/dst\n"
94+
]
95+
}
96+
],
97+
"prompt_number": 3
98+
},
99+
{
100+
"cell_type": "markdown",
101+
"metadata": {},
102+
"source": [
103+
"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:"
104+
]
105+
},
106+
{
107+
"cell_type": "code",
108+
"collapsed": false,
109+
"input": [
110+
"gh = github3.login('username', 'password')"
111+
],
112+
"language": "python",
113+
"metadata": {},
114+
"outputs": [],
115+
"prompt_number": 4
116+
},
117+
{
118+
"cell_type": "code",
119+
"collapsed": false,
120+
"input": [
121+
"for repository in gh.all_repositories():\n",
122+
" print('{0} - id: {0.id}, url: {0.html_url}'.format(repository))"
123+
],
124+
"language": "python",
125+
"metadata": {},
126+
"outputs": []
127+
}
128+
],
129+
"metadata": {}
130+
}
131+
]
132+
}

0 commit comments

Comments
 (0)
0