|
3 | 3 | # Licensed under the MIT License |
4 | 4 | # https://opensource.org/licenses/MIT |
5 | 5 | """ |
6 | | -This module contains the request handing and actual api wrapping functionality. |
| 6 | +This module contains the request handing and actual API wrapping functionality. |
7 | 7 |
|
8 | | -It's core method is the ``ResultStream`` object, which takes the API call |
| 8 | +Its core method is the ``ResultStream`` object, which takes the API call |
9 | 9 | arguments and returns a stream of results to the user. |
10 | 10 | """ |
11 | 11 |
|
|
30 | 30 |
|
31 | 31 | def make_session(username=None, password=None, bearer_token=None): |
32 | 32 | """Creates a Requests Session for use. Accepts a bearer token |
33 | | - for freemium users and will override username and password information if |
| 33 | + for premiums users and will override username and password information if |
34 | 34 | present. |
35 | 35 |
|
36 | 36 | Args: |
@@ -113,7 +113,7 @@ def request(session, url, rule_payload, **kwargs): |
113 | 113 | Args: |
114 | 114 | session (requests.Session): the valid session object |
115 | 115 | url (str): Valid API endpoint |
116 | | - rule_payload (str or dict): rule package for the POST. if you pass a |
| 116 | + rule_payload (str or dict): rule package for the POST. If you pass a |
117 | 117 | dictionary, it will be converted into JSON. |
118 | 118 | """ |
119 | 119 | if isinstance(rule_payload, dict): |
@@ -187,8 +187,8 @@ def __init__(self, endpoint, rule_payload, username=None, password=None, |
187 | 187 | def stream(self): |
188 | 188 | """ |
189 | 189 | Main entry point for the data from the API. Will automatically paginate |
190 | | - through the results via the 'next' token and return up to `max_results` |
191 | | - tweets or up to `max_requests` api calls, whichever is lower. |
| 190 | + through the results via the ``next`` token and return up to ``max_results`` |
| 191 | + tweets or up to ``max_requests`` API calls, whichever is lower. |
192 | 192 |
|
193 | 193 | Usage: |
194 | 194 | >>> result_stream = ResultStream(**kwargs) |
@@ -235,12 +235,12 @@ def check_counts(self): |
235 | 235 | Disables tweet parsing if the count API is used. |
236 | 236 | """ |
237 | 237 | if "counts" in re.split("[/.]", self.endpoint): |
238 | | - logger.info("disabling tweet parsing due to counts api usage") |
| 238 | + logger.info("disabling tweet parsing due to counts API usage") |
239 | 239 | self._tweet_func = lambda x: x |
240 | 240 |
|
241 | 241 | def execute_request(self): |
242 | 242 | """ |
243 | | - Sends the request to the api and parses the json response. |
| 243 | + Sends the request to the API and parses the json response. |
244 | 244 | Makes some assumptions about the session length and sets the presence |
245 | 245 | of a "next" token. |
246 | 246 | """ |
@@ -268,15 +268,15 @@ def __repr__(self): |
268 | 268 |
|
269 | 269 | def collect_results(rule, max_results=500, result_stream_args=None): |
270 | 270 | """ |
271 | | - Utility function to quickly get a list of tweets from a resultstream |
272 | | - without keeping the object around. Rqequires your args to be configured |
| 271 | + Utility function to quickly get a list of tweets from a ``ResultStream`` |
| 272 | + without keeping the object around. Requires your args to be configured |
273 | 273 | prior to using. |
274 | 274 |
|
275 | 275 | Args: |
276 | 276 | rule (str): valid powertrack rule for your account, preferably |
277 | 277 | generated by the `gen_rule_payload` function. |
278 | 278 | max_results (int): maximum number of tweets or counts to return from |
279 | | - the API / underlying resultstream object. |
| 279 | + the API / underlying ``ResultStream`` object. |
280 | 280 | result_stream_args (dict): configuration dict that has connection |
281 | 281 | information for a ``ResultStream`` object. |
282 | 282 |
|
|
0 commit comments