1
+ {
2
+ "metadata" : {
3
+ "name" : " " ,
4
+ "signature" : " sha256:38e38a4a830fca0d759f9c8ac7f7b947e53586dfe760575d6d01730893498fa5"
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
+ " Gists API"
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
+ " gist = github3.gist('44885b92ce00e105b92e')"
35
+ ],
36
+ "language" : " python" ,
37
+ "metadata" : {},
38
+ "outputs" : [],
39
+ "prompt_number" : 2
40
+ },
41
+ {
42
+ "cell_type" : " code" ,
43
+ "collapsed" : false ,
44
+ "input" : [
45
+ " print('Gist {0.id} is {1}'.format(gist, 'public' if gist.public else 'private'))"
46
+ ],
47
+ "language" : " python" ,
48
+ "metadata" : {},
49
+ "outputs" : [
50
+ {
51
+ "output_type" : " stream" ,
52
+ "stream" : " stdout" ,
53
+ "text" : [
54
+ " Gist 44885b92ce00e105b92e is public\n "
55
+ ]
56
+ }
57
+ ],
58
+ "prompt_number" : 3
59
+ },
60
+ {
61
+ "cell_type" : " code" ,
62
+ "collapsed" : false ,
63
+ "input" : [
64
+ " print('Gist {0.id} can be cloned from {0.git_pull_url}'.format(gist))"
65
+ ],
66
+ "language" : " python" ,
67
+ "metadata" : {},
68
+ "outputs" : [
69
+ {
70
+ "output_type" : " stream" ,
71
+ "stream" : " stdout" ,
72
+ "text" : [
73
+ " Gist 44885b92ce00e105b92e can be cloned from https://gist.github.com/44885b92ce00e105b92e.git\n "
74
+ ]
75
+ }
76
+ ],
77
+ "prompt_number" : 4
78
+ },
79
+ {
80
+ "cell_type" : " code" ,
81
+ "collapsed" : false ,
82
+ "input" : [
83
+ " print('Gist {0.id} was created by {0.owner} on {0.created_at}'.format(gist))"
84
+ ],
85
+ "language" : " python" ,
86
+ "metadata" : {},
87
+ "outputs" : [
88
+ {
89
+ "output_type" : " stream" ,
90
+ "stream" : " stdout" ,
91
+ "text" : [
92
+ " Gist 44885b92ce00e105b92e was created by sigmavirus24 on 2014-08-10 13:21:21+00:00\n "
93
+ ]
94
+ }
95
+ ],
96
+ "prompt_number" : 6
97
+ },
98
+ {
99
+ "cell_type" : " code" ,
100
+ "collapsed" : false ,
101
+ "input" : [
102
+ " print(gist.comments_count)"
103
+ ],
104
+ "language" : " python" ,
105
+ "metadata" : {},
106
+ "outputs" : [
107
+ {
108
+ "output_type" : " stream" ,
109
+ "stream" : " stdout" ,
110
+ "text" : [
111
+ " 1\n "
112
+ ]
113
+ }
114
+ ],
115
+ "prompt_number" : 7
116
+ },
117
+ {
118
+ "cell_type" : " code" ,
119
+ "collapsed" : false ,
120
+ "input" : [
121
+ " for comment in gist.comments():\n " ,
122
+ " print('\" {0.body_text}\" posted by {0.user}'.format(comment))"
123
+ ],
124
+ "language" : " python" ,
125
+ "metadata" : {},
126
+ "outputs" : [
127
+ {
128
+ "output_type" : " stream" ,
129
+ "stream" : " stdout" ,
130
+ "text" : [
131
+ " \" funny\" posted by mauricioabreu\n "
132
+ ]
133
+ }
134
+ ],
135
+ "prompt_number" : 8
136
+ },
137
+ {
13
BFAC
8
+ "cell_type" : " code" ,
139
+ "collapsed" : false ,
140
+ "input" : [
141
+ " for gist_file in gist.files():\n " ,
142
+ " print('There is a file named {0.filename} that is {0.size} bytes long.'.format(gist_file))"
143
+ ],
144
+ "language" : " python" ,
145
+ "metadata" : {},
146
+ "outputs" : [
147
+ {
148
+ "output_type" : " stream" ,
149
+ "stream" : " stdout" ,
150
+ "text" : [
151
+ " There is a file named pascal's output that is 278 bytes long.\n " ,
152
+ " There is a file named pascals_triangle.py that is 367 bytes long.\n "
153
+ ]
154
+ }
155
+ ],
156
+ "prompt_number" : 9
157
+ }
158
+ ],
159
+ "metadata" : {}
160
+ }
161
+ ]
162
+ }
0 commit comments