Skip to content

Commit 619dc78

Browse files
author
Aaron Gonzales
authored
Merge pull request #10 from twitterdev/naming_results_params
updated command-line utility to work with naming changes
2 parents c5f5562 + a34b895 commit 619dc78

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

README.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The ``--endpoint`` flag will specify the full URL of your connection, e.g.:
5353
5454
You can find this url in your developer console.
5555

56-
Note that the ``--max-results`` flag specifies an argument to the API call (results returned per CALL), not as a hard max to number of results returned from this program. use ``--max-tweets`` for that for now.
56+
Note that the ``--results-per-call`` flag specifies an argument to the API call ( ``maxResults``, results returned per CALL), not as a hard max to number of results returned from this program. use ``--max-results`` for that for now.
5757

5858

5959

@@ -64,8 +64,8 @@ Note that the ``--max-results`` flag specifies an argument to the API call (resu
6464
python twitter_search.py \
6565
--bearer-token <BEARER_TOKEN> \
6666
--endpoint <MY_ENDPOINT> \
67-
--max-tweets 1000 \
68-
--max-results 100 \
67+
--max-results 1000 \
68+
--results-per-call 100 \
6969
--filter-rule "beyonce has:hashtags" \
7070
--print-stream
7171
@@ -78,8 +78,8 @@ Note that the ``--max-results`` flag specifies an argument to the API call (resu
7878
--user-name <USERNAME> \
7979
--password <PW> \
8080
--endpoint <MY_ENDPOINT> \
81-
--max-tweets 1000 \
82-
--max-results 100 \
81+
--max-results 1000 \
82+
--results-per-call 100 \
8383
--filter-rule "beyonce has:hashtags" \
8484
--filename-prefix beyonce_geo \
8585
--print-stream
@@ -93,8 +93,8 @@ Note that the ``--max-results`` flag specifies an argument to the API call (resu
9393
--user-name <USERNAME> \
9494
--password <PW> \
9595
--endpoint <MY_ENDPOINT> \
96-
--max-tweets 100 \
9796
--max-results 100 \
97+
--results-per-call 100 \
9898
--filter-rule "beyonce has:hashtags" \
9999
--filename-prefix beyonce_geo \
100100
--no-print-stream
@@ -122,7 +122,7 @@ It can be far easier to specify your information in a configuration file. An exa
122122
123123
124124
[search_params]
125-
max_tweets = 500
125+
max_results = 500
126126
127127
[output_params]
128128
output_file_prefix = beyonce

tools/twitter_search.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ def parse_cmd_args():
7171
default=None,
7272
help="PowerTrack filter rule (See: http://support.gnip.com/customer/portal/articles/901152-powertrack-operators)")
7373

74-
twitter_parser.add_argument("--max-results", dest="max_results",
74+
twitter_parser.add_argument("--results-per-call", dest="results_per_call",
7575
default=100,
76-
help="Maximum results to return per api call (default 100; max 500)")
76+
help="Number of results to return per call "
77+
"(default 100; max 500) - corresponds to "
78+
"'maxResults' in the API")
7779

78-
twitter_parser.add_argument("--max-tweets", dest="max_tweets",
80+
twitter_parser.add_argument("--max-results", dest="max_results",
7981
default=500,
8082
type=int,
8183
help="Maximum results to return for this "
@@ -86,8 +88,8 @@ def parse_cmd_args():
8688
dest="max_pages",
8789
type=int,
8890
default=None,
89-
help="Maximum number of pages to use "
90-
"for this session.")
91+
help="Maximum number of pages/api calls to "
92+
"use for this session.")
9193

9294
twitter_parser.add_argument("--results-per-file", dest="results_per_file",
9395
default=0,

twittersearch/api_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def gen_params_from_config(config_dict):
185185
"bearer_token": config_dict.get("bearer_token"),
186186
"rule_payload": rule,
187187
"results_per_file": int(config_dict.get("results_per_file")),
188-
"max_tweets": int(config_dict.get("max_tweets")),
188+
"max_results": int(config_dict.get("max_results")),
189189
"max_pages": config_dict.get("max_pages", None)}
190190
return _dict
191191

0 commit comments

Comments
 (0)