Skip to content

Commit 7262a8b

Browse files
committed
Add notebook demonstrating how to list issues on a repo
1 parent 89f26dc commit 7262a8b

1 file changed

Lines changed: 315 additions & 0 deletions

File tree

Lines changed: 315 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,315 @@
1+
{
2+
"metadata": {
3+
"name": "",
4+
"signature": "sha256:fc7950b40a0653a8dc7ce1323731a435b263dc3b10b320ba7e6b3c74683ff36f"
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+
"Retrieving a repository's issues"
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+
"repo = github3.repository('sigmavirus24', 'github3.py')"
35+
],
36+
"language": "python",
37+
"metadata": {},
38+
"outputs": [],
39+
"prompt_number": 2
40+
},
41+
{
42+
"cell_type": "code",
43+
"collapsed": false,
44+
"input": [
45+
"for issue in repo.issues():\n",
46+
" print('{0}#{1.number}: \"{1.title}\"\\n\\t{1.html_url}'.format(repo, issue))"
47+
],
48+
"language": "python",
49+
"metadata": {},
50+
"outputs": [
51+
{
52+
"output_type": "stream",
53+
"stream": "stdout",
54+
"text": [
55+
"sigmavirus24/github3.py#270: \"IPython docs\"\n",
56+
"\thttps://github.com/sigmavirus24/github3.py/pull/270\n",
57+
"sigmavirus24/github3.py#269: \"Deprecate old team members API. Add new API\"\n",
58+
"\thttps://github.com/sigmavirus24/github3.py/issues/269\n",
59+
"sigmavirus24/github3.py#263: \"Replace Repository#comments_on_commit with RepoCommit#comments\"\n",
60+
"\thttps://github.com/sigmavirus24/github3.py/issues/263\n",
61+
"sigmavirus24/github3.py#262: \"iter_notifications(all=[bool]) should work passing True\"\n",
62+
"\thttps://github.com/sigmavirus24/github3.py/issues/262\n",
63+
"sigmavirus24/github3.py#258: \"User Keys Are Now Immutable\"\n",
64+
"\thttps://github.com/sigmavirus24/github3.py/issues/258\n",
65+
"sigmavirus24/github3.py#257: \"New attributes for PullRequestReviewComment events\"\n",
66+
"\thttps://github.com/sigmavirus24/github3.py/issues/257\n",
67+
"sigmavirus24/github3.py#256: \"[New] Statuses\"\n",
68+
"\thttps://github.com/sigmavirus24/github3.py/issues/256\n",
69+
"sigmavirus24/github3.py#255: \"Malformed Tag Causes AttributeError in models.py\"\n",
70+
"\thttps://github.com/sigmavirus24/github3.py/issues/255\n",
71+
"sigmavirus24/github3.py#253: \"Pull request commits fields are not set\"\n",
72+
"\thttps://github.com/sigmavirus24/github3.py/issues/253\n",
73+
"sigmavirus24/github3.py#248: \"Switch to (absolute) relative imports to allow for vendoring\"\n",
74+
"\thttps://github.com/sigmavirus24/github3.py/issues/248\n",
75+
"sigmavirus24/github3.py#241: \"removed duplicate documentation\"\n",
76+
"\thttps://github.com/sigmavirus24/github3.py/pull/241\n",
77+
"sigmavirus24/github3.py#226: \"ETag support for single objects\"\n",
78+
"\thttps://github.com/sigmavirus24/github3.py/issues/226\n",
79+
"sigmavirus24/github3.py#217: \"API does not handle unicode well\"\n",
80+
"\thttps://github.com/sigmavirus24/github3.py/issues/217\n",
81+
"sigmavirus24/github3.py#206: \"Better documentation regarding a repo's issues\"\n",
82+
"\thttps://github.com/sigmavirus24/github3.py/issues/206\n",
83+
"sigmavirus24/github3.py#191: \"Start a branch for updating the docs\"\n",
84+
"\thttps://github.com/sigmavirus24/github3.py/pull/191\n",
85+
"sigmavirus24/github3.py#187: \"Document two factor auth\"\n",
86+
"\thttps://github.com/sigmavirus24/github3.py/issues/187\n",
87+
"sigmavirus24/github3.py#186: \"Support SNI for Releases API\"\n",
88+
"\thttps://github.com/sigmavirus24/github3.py/issues/186\n",
89+
"sigmavirus24/github3.py#159: \"Create documentation for testing github3.py\"\n",
90+
"\thttps://github.com/sigmavirus24/github3.py/issues/159\n",
91+
"sigmavirus24/github3.py#122: \"Roadmap for 1.0\"\n",
92+
"\thttps://github.com/sigmavirus24/github3.py/issues/122\n",
93+
"sigmavirus24/github3.py#79: \"Caching support!\"\n",
94+
"\thttps://github.com/sigmavirus24/github3.py/issues/79\n"
95+
]
96+
}
97+
],
98+
"prompt_number": 4
99+
},
100+
{
101+
"cell_type": "markdown",
102+
"metadata": {},
103+
"source": [
104+
"You can also list closed issues."
105+
]
106+
},
107+
{
108+
"cell_type": "code",
109+
"collapsed": false,
110+
"input": [
111+
"repo = github3.repository('sigmavirus24', 'requests-toolbelt')"
112+
],
113+
"language": "python",
114+
"metadata": {},
115+
"outputs": [],
116+
"prompt_number": 5
117+
},
118+
{
119+
"cell_type": "code",
120+
"collapsed": false,
121+
"input": [
122+
"for issue in repo.issues(state='closed'):\n",
123+
" print('{0}#{1.number}: \"{1.title}\"\\n\\t{1.html_url}'.format(repo, issue))"
124+
],
125+
"language": "python",
126+
"metadata": {},
127+
"outputs": [
128+
{
129+
"output_type": "stream",
130+
"stream": "stdout",
131+
"text": [
132+
"sigmavirus24/requests-toolbelt#36: \"Some fields do not get uploaded\"\n",
133+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/36\n",
134+
"sigmavirus24/requests-toolbelt#35: \"Add ssl_version to the list of attributes\"\n",
135+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/35\n",
136+
"sigmavirus24/requests-toolbelt#34: \"SSLAdapter crashes if used with multiprocessing\"\n",
137+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/34\n",
138+
"sigmavirus24/requests-toolbelt#33: \"Add support for multipart/mixed\"\n",
139+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/33\n",
140+
"sigmavirus24/requests-toolbelt#31: \"MultipartEncoder.read() returns less than 8192 bytes even when more bytes are left\"\n",
141+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/31\n",
142+
"sigmavirus24/requests-toolbelt#29: \"Multipart encoder cannot be reused\"\n",
143+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/29\n",
144+
"sigmavirus24/requests-toolbelt#28: \"GuessAuth\"\n",
145+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/28\n",
146+
"sigmavirus24/requests-toolbelt#27: \"Request for Comments: Implement RFC 5987\"\n",
147+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/27\n",
148+
"sigmavirus24/requests-toolbelt#25: \"Import authors to setup.py\"\n",
149+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/25\n",
150+
"sigmavirus24/requests-toolbelt#24: \"Import metadata from package to setup.py\"\n",
151+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/24\n",
152+
"sigmavirus24/requests-toolbelt#23: \"Add encoding comment to `*.py`\"\n",
153+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/23\n",
154+
"sigmavirus24/requests-toolbelt#22: \"Add Monitor for MultipartEncoder\"\n",
155+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/22\n",
156+
"sigmavirus24/requests-toolbelt#20: \"README.rst: minor edits, syntax highlighting\"\n",
157+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/20\n",
158+
"sigmavirus24/requests-toolbelt#18: \"Slightly refactored MultipartEncoder + improved unit tests\"\n",
159+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/18\n",
160+
"sigmavirus24/requests-toolbelt#17: \"MultipartEncoder sometimes add bytes\"\n",
161+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/17\n",
162+
"sigmavirus24/requests-toolbelt#16: \"`MultipartEncoder` not fully compliant with RFC 1521\"\n",
163+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/16\n",
164+
"sigmavirus24/requests-toolbelt#15: \"Adding Multipart Decoder, redux\"\n",
165+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/15\n",
166+
"sigmavirus24/requests-toolbelt#14: \"Added MultipartDecoder.\"\n",
167+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/14\n",
168+
"sigmavirus24/requests-toolbelt#13: \"add explicit utf-8 encoding\"\n",
169+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/13\n",
170+
"sigmavirus24/requests-toolbelt#12: \"MultipartEncoder: added callback support and bytes read counter\"\n",
171+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/12\n",
172+
"sigmavirus24/requests-toolbelt#11: \"Get version info from a file that actually exists\"\n",
173+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/11\n",
174+
"sigmavirus24/requests-toolbelt#10: \"pip install fails with requests 1.2.3\"\n",
175+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/10\n",
176+
"sigmavirus24/requests-toolbelt#9: \"'file' does not have the buffer interface\"\n",
177+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/9\n",
178+
"sigmavirus24/requests-toolbelt#8: \"Invalid multipart encoding with a file\"\n",
179+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/8\n",
180+
"sigmavirus24/requests-toolbelt#7: \"Many docs updates\"\n",
181+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/7\n",
182+
"sigmavirus24/requests-toolbelt#6: \"Mention SSLAdapter in README.\"\n",
183+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/6\n",
184+
"sigmavirus24/requests-toolbelt#5: \"Include the ever-popular SSLAdapter.\"\n",
185+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/5\n",
186+
"sigmavirus24/requests-toolbelt#4: \"Attempt to limit how much is ever actually in memory\"\n",
187+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/4\n",
188+
"sigmavirus24/requests-toolbelt#3: \"User agent constructor.\"\n",
189+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/3\n",
190+
"sigmavirus24/requests-toolbelt#2: \"README fixes\"\n",
191+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/2\n",
192+
"sigmavirus24/requests-toolbelt#1: \"Uploader does not really stream\"\n",
193+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/1\n"
194+
]
195+
}
196+
],
197+
"prompt_number": 6
198+
},
199+
{
200+
"cell_type": "markdown",
201+
"metadata": {},
202+
"source": [
203+
"Finally, you can list `all` issues. This time, let's change the direction we list them in."
204+
]
205+
},
206+
{
207+
"cell_type": "code",
208+
"collapsed": false,
209+
"input": [
210+
"for issue in repo.issues(state='all', direction='asc'):\n",
211+
" print('{0}#{1.number}: \"{1.title}\"\\n\\t{1.html_url}'.format(repo, issue))"
212+
],
213+
"language": "python",
214+
"metadata": {},
215+
"outputs": [
216+
{
217+
"output_type": "stream",
218+
"stream": "stdout",
219+
"text": [
220+
"sigmavirus24/requests-toolbelt#1: \"Uploader does not really stream\"\n",
221+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/1\n",
222+
"sigmavirus24/requests-toolbelt#2: \"README fixes\"\n",
223+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/2\n",
224+
"sigmavirus24/requests-toolbelt#3: \"User agent constructor.\"\n",
225+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/3\n",
226+
"sigmavirus24/requests-toolbelt#4: \"Attempt to limit how much is ever actually in memory\"\n",
227+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/4\n",
228+
"sigmavirus24/requests-toolbelt#5: \"Include the ever-popular SSLAdapter.\"\n",
229+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/5\n",
230+
"sigmavirus24/requests-toolbelt#6: \"Mention SSLAdapter in README.\"\n",
231+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/6\n",
232+
"sigmavirus24/requests-toolbelt#7: \"Many docs updates\"\n",
233+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/7\n",
234+
"sigmavirus24/requests-toolbelt#8: \"Invalid multipart encoding with a file\"\n",
235+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/8\n",
236+
"sigmavirus24/requests-toolbelt#9: \"'file' does not have the buffer interface\"\n",
237+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/9\n",
238+
"sigmavirus24/requests-toolbelt#10: \"pip install fails with requests 1.2.3\"\n",
239+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/10\n",
240+
"sigmavirus24/requests-toolbelt#11: \"Get version info from a file that actually exists\"\n",
241+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/11\n",
242+
"sigmavirus24/requests-toolbelt#12: \"MultipartEncoder: added callback support and bytes read counter\"\n",
243+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/12\n",
244+
"sigmavirus24/requests-toolbelt#13: \"add explicit utf-8 encoding\"\n",
245+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/13\n",
246+
"sigmavirus24/requests-toolbelt#14: \"Added MultipartDecoder.\"\n",
247+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/14\n",
248+
"sigmavirus24/requests-toolbelt#15: \"Adding Multipart Decoder, redux\"\n",
249+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/15\n",
250+
"sigmavirus24/requests-toolbelt#16: \"`MultipartEncoder` not fully compliant with RFC 1521\"\n",
251+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/16\n",
252+
"sigmavirus24/requests-toolbelt#17: \"MultipartEncoder sometimes add bytes\"\n",
253+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/17\n",
254+
"sigmavirus24/requests-toolbelt#18: \"Slightly refactored MultipartEncoder + improved unit tests\"\n",
255+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/18\n",
256+
"sigmavirus24/requests-toolbelt#19: \"IPv6 Transport Adapter\"\n",
257+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/19\n",
258+
"sigmavirus24/requests-toolbelt#20: \"README.rst: minor edits, syntax highlighting\"\n",
259+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/20\n",
260+
"sigmavirus24/requests-toolbelt#21: \"WIP: AuthHandler\"\n",
261+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/21\n",
262+
"sigmavirus24/requests-toolbelt#22: \"Add Monitor for MultipartEncoder\"\n",
263+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/22\n",
264+
"sigmavirus24/requests-toolbelt#23: \"Add encoding comment to `*.py`\"\n",
265+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/23\n",
266+
"sigmavirus24/requests-toolbelt#24: \"Import metadata from package to setup.py\"\n",
267+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/24\n",
268+
"sigmavirus24/requests-toolbelt#25: \"Import authors to setup.py\"\n",
269+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/25\n",
270+
"sigmavirus24/requests-toolbelt#26: \"illegal seek uploading data stream\"\n",
271+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/26\n",
272+
"sigmavirus24/requests-toolbelt#27: \"Request for Comments: Implement RFC 5987\"\n",
273+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/27\n",
274+
"sigmavirus24/requests-toolbelt#28: \"GuessAuth\"\n",
275+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/28\n",
276+
"sigmavirus24/requests-toolbelt#29: \"Multipart encoder cannot be reused\"\n",
277+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/29\n",
278+
"sigmavirus24/requests-toolbelt#30: \"File object not closed\"\n",
279+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/30\n",
280+
"sigmavirus24/requests-toolbelt#31: \"MultipartEncoder.read() returns less than 8192 bytes even when more bytes are left\"\n",
281+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/31\n",
282+
"sigmavirus24/requests-toolbelt#32: \"Duplicated content in user.rst and README.rst?\"\n",
283+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/32\n",
284+
"sigmavirus24/requests-toolbelt#33: \"Add support for multipart/mixed\"\n",
285+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/33\n",
286+
"sigmavirus24/requests-toolbelt#34: \"SSLAdapter crashes if used with multiprocessing\"\n",
287+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/34\n",
288+
"sigmavirus24/requests-toolbelt#35: \"Add ssl_version to the list of attributes\"\n",
289+
"\thttps://github.com/sigmavirus24/requests-toolbelt/pull/35\n",
290+
"sigmavirus24/requests-toolbelt#36: \"Some fields do not get uploaded\"\n",
291+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/36\n",
292+
"sigmavirus24/requests-toolbelt#37: \"Improve documentation\"\n",
293+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/37\n",
294+
"sigmavirus24/requests-toolbelt#38: \"Add from_file classmethod to StreamingIterator\"\n",
295+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/38\n",
296+
"sigmavirus24/requests-toolbelt#39: \"MultipartEncoder int encoding issues\"\n",
297+
"\thttps://github.com/sigmavirus24/requests-toolbelt/issues/39\n"
298+
]
299+
}
300+
],
301+
"prompt_number": 7
302+
},
303+
{
304+
"cell_type": "code",
305+
"collapsed": false,
306+
"input": [],
307+
"language": "python",
308+
"metadata": {},
309+
"outputs": []
310+
}
311+
],
312+
"metadata": {}
313+
}
314+
]
315+
}

0 commit comments

Comments
 (0)