Skip to content

Commit 1a484b7

Browse files
author
Aaron Gonzales
committed
updated readme and example text
1 parent 86b1b71 commit 1a484b7

File tree

3 files changed

+13
-79
lines changed

3 files changed

+13
-79
lines changed

README.rst

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ your authentication will be a (username, password) pair. If you are a
155155
premium client, you'll need to get a bearer token that will be passed
156156
with each call for authentication.
157157

158-
We advocate putting your API info in a yaml file such as this:
158+
Your credentials should be put into a YAML file that looks like this:
159159

160160
.. code:: .yaml
161161

@@ -172,7 +172,7 @@ Premium users should only have the ``endpoint`` and ``bearer_token``;
172172
Enterprise customers should have ``account``, ``username``,
173173
``endpoint``, and ``password``.
174174

175-
Our credential reader will default to expecing this file in
175+
Our credential reader expects this file at
176176
``"~/.twitter_search.yaml"``, but you can pass the relevant location as
177177
needed.
178178

@@ -181,9 +181,6 @@ throughout your program's session.
181181

182182
.. code:: python
183183
184-
import os
185-
import json
186-
187184
from twittersearch import ResultStream, gen_rule_payload, load_credentials
188185
189186
Enterprise setup
@@ -542,19 +539,6 @@ method; please see your developer console for details.
542539
Setting up at @CampFlogGnaw https://t.co/nVq8QjkKsf
543540
544541
545-
.. code:: python
546-
547-
premium_search_args.keys()
548-
549-
550-
551-
552-
.. parsed-literal::
553-
554-
dict_keys(['bearer_token', 'endpoint'])
555-
556-
557-
558542
.. code:: python
559543
560544
rule = gen_rule_payload("from:jack",
@@ -621,4 +605,3 @@ method; please see your developer console for details.
621605
{'timePeriod': '201709220000', 'count': 0}
622606
{'timePeriod': '201709210000', 'count': 1}
623607
{'timePeriod': '201709200000', 'count': 7}
624-

examples/api_example.ipynb

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"\n",
1414
"Prior to starting your program, an easy way to define your secrets will be setting an environment variable. If you are an enterprise client, your authentication will be a (username, password) pair. If you are a premium client, you'll need to get a bearer token that will be passed with each call for authentication.\n",
1515
"\n",
16-
"We advocate putting your API info in a yaml file such as this:\n",
16+
"Your credentials should be put into a YAML file that looks like this:\n",
1717
"\n",
1818
"\n",
1919
"```.yaml\n",
@@ -41,10 +41,6 @@
4141
},
4242
"outputs": [],
4343
"source": [
44-
"import os\n",
45-
"import json\n",
46-
"from unidecode import unidecode\n",
47-
"\n",
4844
"from twittersearch import ResultStream, gen_rule_payload, load_credentials"
4945
]
5046
},
@@ -59,20 +55,11 @@
5955
},
6056
{
6157
"cell_type": "code",
62-
"execution_count": 2,
58+
"execution_count": 42,
6359
"metadata": {
6460
"collapsed": true
6561
},
6662
"outputs": [],
67-
"source": [
68-
"from twittersearch import infer_endpoint"
69-
]
70-
},
71-
{
72-
"cell_type": "code",
73-
"execution_count": 42,
74-
"metadata": {},
75-
"outputs": [],
7663
"source": [
7764
"enterprise_search_args = load_credentials(\"~/.twitter_keys.yaml\",\n",
7865
" account_type=\"enterprise\")"
@@ -169,6 +156,7 @@
169156
"cell_type": "code",
170157
"execution_count": 46,
171158
"metadata": {
159+
"collapsed": true,
172160
"scrolled": true
173161
},
174162
"outputs": [],
@@ -333,7 +321,9 @@
333321
{
334322
"cell_type": "code",
335323
"execution_count": 56,
336-
"metadata": {},
324+
"metadata": {
325+
"collapsed": true
326+
},
337327
"outputs": [],
338328
"source": [
339329
"tweets = list(rs.stream())"
@@ -401,7 +391,9 @@
401391
{
402392
"cell_type": "code",
403393
"execution_count": 24,
404-
"metadata": {},
394+
"metadata": {
395+
"collapsed": true
396+
},
405397
"outputs": [],
406398
"source": [
407399
"count_rule = gen_rule_payload(\"beyonce\", count_bucket=\"day\")\n",
@@ -541,26 +533,6 @@
541533
"[print(tweet.all_text) for tweet in tweets[0:10]];"
542534
]
543535
},
544-
{
545-
"cell_type": "code",
546-
"execution_count": 58,
547-
"metadata": {},
548-
"outputs": [
549-
{
550-
"data": {
551-
"text/plain": [
552-
"dict_keys(['bearer_token', 'endpoint'])"
553-
]
554-
},
555-
"execution_count": 58,
556-
"metadata": {},
557-
"output_type": "execute_result"
558-
}
559-
],
560-
"source": [
561-
"premium_search_args.keys()"
562-
]
563-
},
564536
{
565537
"cell_type": "code",
566538
"execution_count": 37,

examples/readme.rst

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ your authentication will be a (username, password) pair. If you are a
1515
premium client, you'll need to get a bearer token that will be passed
1616
with each call for authentication.
1717

18-
We advocate putting your API info in a yaml file such as this:
18+
Your credentials should be put into a YAML file that looks like this:
1919

2020
.. code:: .yaml
2121

@@ -32,7 +32,7 @@ Premium users should only have the ``endpoint`` and ``bearer_token``;
3232
Enterprise customers should have ``account``, ``username``,
3333
``endpoint``, and ``password``.
3434

35-
Our credential reader will default to expecing this file in
35+
Our credential reader expects this file at
3636
``"~/.twitter_search.yaml"``, but you can pass the relevant location as
3737
needed.
3838

@@ -41,10 +41,6 @@ throughout your program's session.
4141

4242
.. code:: python
4343
44-
import os
45-
import json
46-
from unidecode import unidecode
47-
4844
from twittersearch import ResultStream, gen_rule_payload, load_credentials
4945
5046
Enterprise setup
@@ -53,10 +49,6 @@ Enterprise setup
5349
If you are an enterprise customer, you'll need to authenticate with a
5450
basic username/password method. You can specify that here:
5551

56-
.. code:: python
57-
58-
from twittersearch import infer_endpoint
59-
6052
.. code:: python
6153
6254
enterprise_search_args = load_credentials("~/.twitter_keys.yaml",
@@ -407,19 +399,6 @@ method; please see your developer console for details.
407399
Setting up at @CampFlogGnaw https://t.co/nVq8QjkKsf
408400
409401
410-
.. code:: python
411-
412-
premium_search_args.keys()
413-
414-
415-
416-
417-
.. parsed-literal::
418-
419-
dict_keys(['bearer_token', 'endpoint'])
420-
421-
422-
423402
.. code:: python
424403
425404
rule = gen_rule_payload("from:jack",

0 commit comments

Comments
 (0)