You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/api_example.ipynb
+121-3Lines changed: 121 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,9 @@
28
28
{
29
29
"cell_type": "code",
30
30
"execution_count": 1,
31
-
"metadata": {},
31
+
"metadata": {
32
+
"collapsed": true
33
+
},
32
34
"outputs": [],
33
35
"source": [
34
36
"import os\n",
@@ -48,7 +50,9 @@
48
50
{
49
51
"cell_type": "code",
50
52
"execution_count": 22,
51
-
"metadata": {},
53
+
"metadata": {
54
+
"collapsed": true
55
+
},
52
56
"outputs": [],
53
57
"source": [
54
58
"# set your environment variables here for enterprise access if you need to\n",
@@ -180,6 +184,13 @@
180
184
"tweets = collect_results(rule, max_results=500, result_stream_args=premium_search_args) # change this if you need to"
181
185
]
182
186
},
187
+
{
188
+
"cell_type": "markdown",
189
+
"metadata": {},
190
+
"source": [
191
+
"By default, tweet payloads are lazily parsed into a `Tweet` object. An overwhelming number of tweet attributes are made available directly, as such:"
192
+
]
193
+
},
183
194
{
184
195
"cell_type": "code",
185
196
"execution_count": 7,
@@ -311,7 +322,114 @@
311
322
"cell_type": "markdown",
312
323
"metadata": {},
313
324
"source": [
314
-
"Let's make a new rule and pass it dates this time. `gen_rule_payload` takes dates of the forms `YYYY-mm-DD` and `YYYYmmDD`. Note that this will only work with the full archive search option, which is available to my account only via the enterprise options."
325
+
"## Counts API\n",
326
+
"\n",
327
+
"We can also use the counts api to get counts of tweets that match our rule. Each request will return up to *30* results, and each count request can be done on a minutely, hourly, or daily basis. There is a utility function that will convert your regular endpoint to the count endpoint.\n",
328
+
"\n",
329
+
"The process is very similar to grabbing tweets, but has some minor differneces.\n",
330
+
"\n",
331
+
"\n",
332
+
"**Caveat - premium sandbox environments do NOT have access to the counts API.**\n",
333
+
"\n"
334
+
]
335
+
},
336
+
{
337
+
"cell_type": "code",
338
+
"execution_count": 23,
339
+
"metadata": {},
340
+
"outputs": [
341
+
{
342
+
"name": "stderr",
343
+
"output_type": "stream",
344
+
"text": [
345
+
"using username and password for authentication\n"
"Let's make a new rule and pass it dates this time.\n",
428
+
"\n",
429
+
"`gen_rule_payload` takes dates of the forms `YYYY-mm-DD` and `YYYYmmDD`.\n",
430
+
"\n",
431
+
"\n",
432
+
"**Note that this will only work with the full archive search option**, which is available to my account only via the enterprise options. Full archive search will likely require a different endpoint or access method; please see your developer console for details."
0 commit comments