-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathoscon2012_users.py
252 lines (250 loc) · 9.57 KB
/
oscon2012_users.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#!/usr/bin/env python
import requests
import json
from requests.auth import HTTPBasicAuth
#
# User Lookup
#
# GET https://api.twitter.com/1/users/lookup.json?screen_name=twitterapi,twitter&include_entities=true
#
url='https://api.twitter.com/1/users/lookup.json'
payload={"screen_name":"twitterapi,twitter,jack"}
r = requests.get(url, params=payload)
print json.dumps(r.headers,sort_keys=True,indent=2)
print json.dumps(r.json,sort_keys=True,indent=2)
'''
Sample Response
@jack id = 12, @twitter = 783214, @twitterapi = 6253282
{
"cache-control": "no-cache, no-store, must-revalidate, pre-check=0, post-check=0",
"content-encoding": "gzip",
"content-length": "1775",
"content-type": "application/json; charset=utf-8",
"date": "Sat, 23 Jun 2012 00:24:06 GMT",
"etag": "\"e93eb3aeb3bf67655c5387fc0e9c2d13\"",
"expires": "Tue, 31 Mar 1981 05:00:00 GMT",
"last-modified": "Sat, 23 Jun 2012 00:24:06 GMT",
"pragma": "no-cache",
"server": "tfe",
"set-cookie": "k=10.35.101.135.1340411046155542; path=/; expires=Sat, 30-Jun-12 00:24:06 GMT; domain=.twitter.com, guest_id=v1%3A134041104616061676; domain=.twitter.com; path=/; expires=Mon, 23-Jun-2014 12:24:06 GMT, _twitter_sess=BAh7CDoPY3JlYXRlZF9hdGwrCBJpuRY4ASIKZmxhc2hJQzonQWN0aW9uQ29u%250AdHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7ADoHaWQiJTFl%250ANTg0ZmIyOGVlOTlhZGI1NGRhMjYwNzE4NmY3MjU4--b818ad65b801146173a2ab81569c3197ac64383f; domain=.twitter.com; path=/; HttpOnly",
"status": "200 OK",
"vary": "Accept-Encoding",
"x-frame-options": "SAMEORIGIN",
"x-mid": "2134114c7ed2199739fb622fb2c50325699ba39c",
"x-ratelimit-class": "api",
"x-ratelimit-limit": "150",
"x-ratelimit-remaining": "145",
"x-ratelimit-reset": "1340413192",
"x-runtime": "0.03738",
"x-transaction": "1e7707fe2c10b397",
"x-transaction-mask": "a6183ffa5f8ca943ff1b53b5644ef114546a8e75"
}
[
{
"contributors_enabled": true,
"created_at": "Tue Mar 21 20:50:14 +0000 2006",
"default_profile": false,
"default_profile_image": false,
"description": "Executive Chairman of Twitter, CEO of Square, a founder of both.",
"favourites_count": 1047,
"follow_request_sent": false,
"followers_count": 2026857,
"following": false,
"friends_count": 1192,
"geo_enabled": true,
"id": 12,
"id_str": "12",
"is_translator": false,
"lang": "en",
"listed_count": 18036,
"location": "San Francisco",
"name": "Jack Dorsey",
"notifications": false,
"profile_background_color": "EBEBEB",
"profile_background_image_url": "http://a0.twimg.com/images/themes/theme7/bg.gif",
"profile_background_image_url_https": "https://si0.twimg.com/images/themes/theme7/bg.gif",
"profile_background_tile": false,
"profile_image_url": "http://a0.twimg.com/profile_images/1563216547/image_normal.jpg",
"profile_image_url_https": "https://si0.twimg.com/profile_images/1563216547/image_normal.jpg",
"profile_link_color": "990000",
"profile_sidebar_border_color": "DFDFDF",
"profile_sidebar_fill_color": "F3F3F3",
"profile_text_color": "333333",
"profile_use_background_image": true,
"protected": false,
"screen_name": "jack",
"show_all_inline_media": true,
"status": {
"contributors": null,
"coordinates": null,
"created_at": "Fri Jun 22 06:27:29 +0000 2012",
"favorited": false,
"geo": null,
"id": 216054784015335425,
"id_str": "216054784015335425",
"in_reply_to_screen_name": null,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"place": null,
"retweet_count": 34523,
"retweeted": false,
"retweeted_status": {
"contributors": null,
"coordinates": null,
"created_at": "Fri Jun 22 05:54:32 +0000 2012",
"favorited": false,
"geo": null,
"id": 216046493721825280,
"id_str": "216046493721825280",
"in_reply_to_screen_name": null,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"place": null,
"retweet_count": 34523,
"retweeted": false,
"source": "<a href=\"http://www.echofon.com/\" rel=\"nofollow\">Echofon</a>",
"text": "Tough way to end a season but I am truly blessed to have the privilege to play for such a great city, congrats to the Miami Heat..",
"truncated": false
},
"source": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>",
"text": "RT @KDTrey5: Tough way to end a season but I am truly blessed to have the privilege to play for such a great city, congrats to the Miami ...",
"truncated": true
},
"statuses_count": 11242,
"time_zone": "Pacific Time (US & Canada)",
"url": null,
"utc_offset": -28800,
"verified": true
},
{
"contributors_enabled": true,
"created_at": "Tue Feb 20 14:35:54 +0000 2007",
"default_profile": false,
"default_profile_image": false,
"description": "Always wondering what's happening. ",
"favourites_count": 17,
"follow_request_sent": false,
"followers_count": 11278047,
"following": false,
"friends_count": 1064,
"geo_enabled": true,
"id": 783214,
"id_str": "783214",
"is_translator": false,
"lang": "en",
"listed_count": 71495,
"location": "San Francisco, CA",
"name": "Twitter",
"notifications": false,
"profile_background_color": "ACDED6",
"profile_background_image_url": "http://a0.twimg.com/profile_background_images/378245879/Twitter_1544x2000.png",
"profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/378245879/Twitter_1544x2000.png",
"profile_background_tile": true,
"profile_banner_url": "https://si0.twimg.com/brand_banners/twitter/1323368512/live",
"profile_image_url": "http://a0.twimg.com/profile_images/2284174758/v65oai7fxn47qv9nectx_normal.png",
"profile_image_url_https": "https://si0.twimg.com/profile_images/2284174758/v65oai7fxn47qv9nectx_normal.png",
"profile_link_color": "038543",
"profile_sidebar_border_color": "EEEEEE",
"profile_sidebar_fill_color": "F6F6F6",
"profile_text_color": "333333",
"profile_use_background_image": true,
"protected": false,
"screen_name": "twitter",
"show_all_inline_media": true,
"status": {
"contributors": [
7694352
],
"coordinates": null,
"created_at": "Fri Jun 22 16:42:47 +0000 2012",
"favorited": false,
"geo": null,
"id": 216209630475452419,
"id_str": "216209630475452419",
"in_reply_to_screen_name": null,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"place": null,
"possibly_sensitive": false,
"retweet_count": 253,
"retweeted": false,
"source": "web",
"text": "Want to see the best Tweets about #Euro2012 all in one place? We've got you covered. http://t.co/riNDcJZY",
"truncated": false
},
"statuses_count": 1340,
"time_zone": "Pacific Time (US & Canada)",
"url": "http://blog.twitter.com/",
"utc_offset": -28800,
"verified": true
},
{
"contributors_enabled": true,
"created_at": "Wed May 23 06:01:13 +0000 2007",
"default_profile": true,
"default_profile_image": false,
"description": "The Real Twitter API. I tweet about API changes, service issues and happily answer questions about Twitter and our API. Don't get an answer? It's on my website.",
"favourites_count": 24,
"follow_request_sent": false,
"followers_count": 1103346,
"following": false,
"friends_count": 30,
"geo_enabled": true,
"id": 6253282,
"id_str": "6253282",
"is_translator": false,
"lang": "en",
"listed_count": 10550,
"location": "San Francisco, CA",
"name": "Twitter API",
"notifications": false,
"profile_background_color": "C0DEED",
"profile_background_image_url": "http://a0.twimg.com/images/themes/theme1/bg.png",
"profile_background_image_url_https": "https://si0.twimg.com/images/themes/theme1/bg.png",
"profile_background_tile": false,
"profile_image_url": "http://a0.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_normal.png",
"profile_image_url_https": "https://si0.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_normal.png",
"profile_link_color": "0084B4",
"profile_sidebar_border_color": "C0DEED",
"profile_sidebar_fill_color": "DDEEF6",
"profile_text_color": "333333",
"profile_use_background_image": true,
"protected": false,
"screen_name": "twitterapi",
"show_all_inline_media": false,
"status": {
"contributors": [
819797
],
"coordinates": null,
"created_at": "Fri Jun 15 19:57:54 +0000 2012",
"favorited": false,
"geo": null,
"id": 213722016866508802,
"id_str": "213722016866508802",
"in_reply_to_screen_name": "ricktagious",
"in_reply_to_status_id": 213670532372115459,
"in_reply_to_status_id_str": "213670532372115459",
"in_reply_to_user_id": 152138582,
"in_reply_to_user_id_str": "152138582",
"place": null,
"retweet_count": 8,
"retweeted": false,
"source": "web",
"text": "@ricktagious not seeing any issues; consider reaching out to @support for issues on the site. ^TS",
"truncated": false
},
"statuses_count": 3314,
"time_zone": "Pacific Time (US & Canada)",
"url": "http://dev.twitter.com",
"utc_offset": -28800,
"verified": true
}
]
'''