|
6 | 6 |
|
7 | 7 | class NewsApiClient(object): |
8 | 8 |
|
9 | | - def __init__(self, api_key): |
| 9 | + def __init__(self, api_key: str): |
10 | 10 | self.auth = NewsApiAuth(api_key=api_key) |
11 | 11 |
|
12 | | - def get_top_headlines(self, q=None, sources=None, language='en', country=None, category=None, page_size=None, |
13 | | - page=None): |
| 12 | + def get_top_headlines(self, q=None: str, sources=None: str, language='en': str, country=None: str, category=None: str, page_size=20: int, |
| 13 | + page=None: int) -> dict: |
14 | 14 | """ |
15 | 15 | Returns live top and breaking headlines for a country, specific category in a country, single source, or multiple sources.. |
16 | 16 |
|
@@ -48,7 +48,7 @@ def get_top_headlines(self, q=None, sources=None, language='en', country=None, c |
48 | 48 | if type(q) == str: |
49 | 49 | payload['q'] = q |
50 | 50 | else: |
51 | | - raise TypeError('keyword/phrase q param should be a of type str') |
| 51 | + raise TypeError('keyword/phrase q param should be of type str') |
52 | 52 |
|
53 | 53 | # Sources |
54 | 54 | if (sources is not None) and ((country is not None) or (category is not None)): |
@@ -120,9 +120,9 @@ def get_top_headlines(self, q=None, sources=None, language='en', country=None, c |
120 | 120 |
|
121 | 121 | return r.json() |
122 | 122 |
|
123 | | - def get_everything(self, q=None, sources=None, domains=None, exclude_domains=None, |
124 | | - from_param=None, to=None, language=None, sort_by=None, page=None, |
125 | | - page_size=None): |
| 123 | + def get_everything(self, q=None: str, sources=None: str, domains=None: str, exclude_domains=None: str, |
| 124 | + from_param=None: str, to=None: str, language='en': str, sort_by=None: str, page=None: int, |
| 125 | + page_size=20: int) -> dict: |
126 | 126 | """ |
127 | 127 | Search through millions of articles from over 5,000 large and small news sources and blogs. |
128 | 128 |
|
@@ -262,7 +262,7 @@ def get_everything(self, q=None, sources=None, domains=None, exclude_domains=Non |
262 | 262 |
|
263 | 263 | return r.json() |
264 | 264 |
|
265 | | - def get_sources(self, category=None, language=None, country=None): |
| 265 | + def get_sources(self, category=None: str, language='en': str, country=None: str) -> dict: |
266 | 266 | """ |
267 | 267 | Returns the subset of news publishers that top headlines... |
268 | 268 |
|
|
0 commit comments