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
Newsdataapi docs can be seen [here](https://newsdata.io/docs).
29
29
30
30
<br />
31
31
32
-
### Latest News API
33
-
34
-
`GET /1/news`
35
-
36
-
```
37
-
from newsdataapi import NewsDataApiClient
38
-
39
-
# API key authorization, Initialize the client with your API key
40
-
api = NewsDataApiClient(apikey="API key")
41
-
42
-
# You can pass empty or with request parameters {ex. (country = "us")}
43
-
response = api.news_api()
44
-
45
-
```
46
-
`API key` : Your private Newsdata API key.
47
-
48
-
`country` : You can pass a comma seperated string of 2-letter ISO 3166-1 countries (maximum 5) to restrict the search to. Possible Options: `us``gb``in``jp``ae``sa``au``ca``sg`
49
-
50
-
`category` : A comma seperated string of categories (maximum 5) to restrict the search to. Possible Options: `top`, `business`, `science`, `technology`, `sports`, `health`, `entertainment`
51
-
52
-
`language` : A comma seperated string of languages (maximum 5) to restrict the search to. Possible Options: `en`, `ar`, `jp`, `in`, `es`, `fr`
53
-
54
-
`domain` : A comma seperated string of domains (maximum 5) to restrict the search to. Use the /domains endpoint to find top sources id.
55
-
56
-
`q` : Keywords or phrases to search for in the news title and content. The value must be URL-encoded. Advance search options: Search Social q=social, Search "Social Pizza" q=social pizza, Search Social but not with pizza. social -pizza q=social -pizza, Search Social but not with pizza and wildfire. social -pizza -wildfire q=social -pizza -wildfire, Search multiple keyword with AND operator. social AND pizza q=social AND pizza
57
-
58
-
`qInTitle` : Keywords or phrases to search for in the news title only.
59
-
60
-
`page` : Use this to page through the results if the total results found is greater than the page size.
61
-
62
-
63
-
64
-
<br />
65
-
66
-
### News Archive API
67
-
68
-
`GET /1/archive`
69
-
70
-
```
71
-
from newsdataapi import NewsDataApiClient
72
-
73
-
# API key authorization, Initialize the client with your API key
74
-
api = NewsDataApiClient(apikey="API key")
75
-
76
-
# You can pass empty or with request parameters {ex. (country = "us")}
77
-
response = api.archive_api()
78
-
79
-
```
80
-
`API key` : Your private Newsdata API key.
81
-
82
-
`country` : You can pass a comma seperated string of 2-letter ISO 3166-1 countries (maximum 5) to restrict the search to. Possible Options: `us``gb``in``jp``ae``sa``au``ca``sg`
83
-
84
-
`category` : A comma seperated string of categories (maximum 5) to restrict the search to. Possible Options: `top`, `business`, `science`, `technology`, `sports`, `health`, `entertainment`
85
-
86
-
`language` : A comma seperated string of languages (maximum 5) to restrict the search to. Possible Options: `en`, `ar`, `jp`, `in`, `es`, `fr`
87
-
88
-
`domain` : A comma seperated string of domains (maximum 5) to restrict the search to. Use the /domains endpoint to find top sources id.
89
-
90
-
`from_date` : A date and optional time for the oldest article allowed. This should be in ISO 8601 format (e.g. `2021-04-18` or `2021-04-18T04:04:34`)
91
-
92
-
`to_date` : A date and optional time for the newest article allowed. This should be in ISO 8601 format (e.g. `2021-04-18` or `2021-04-18T04:04:34`)
93
-
94
-
`q` : Keywords or phrases to search for in the news title and content. The value must be URL-encoded. Advance search options: Search Social q=social, Search "Social Pizza" q=social pizza, Search Social but not with pizza. social -pizza q=social -pizza, Search Social but not with pizza and wildfire. social -pizza -wildfire q=social -pizza -wildfire, Search multiple keyword with AND operator. social AND pizza q=social AND pizza
95
-
96
-
`qInTitle` : Keywords or phrases to search for in the news title only.
97
-
98
-
`page` : Use this to page through the results if the total results found is greater than the page size.
99
-
100
-
101
-
102
-
<br />
103
-
104
-
105
-
### News Sources API
106
-
107
-
`GET /1/sources`
108
-
109
-
```
110
-
from newsdataapi import NewsDataApiClient
111
-
112
-
# API key authorization, Initialize the client with your API key
113
-
api = NewsDataApiClient(apikey="API key")
114
-
115
-
# You can pass empty or with request parameters {ex. (country = "us")}
116
-
response = api.sources_api()
117
-
118
-
```
119
-
`API key` : Your private Newsdata API key.
120
-
121
-
`country` : Find sources that display news in a specific country. Possible Options: `us``gb``in``jp``ae``sa``au``ca``sg`
122
-
123
-
`category` : Find sources that display news of this category. Possible Options: `top`, `business`, `science`, `technology`, `sports`, `health`, `entertainment`
124
-
125
-
`language` : Find sources that display news in a specific language. Possible Options: `en`, `ar`, `jp`, `in`, `es`, `fr`
126
-
127
-
<br />
128
-
129
-
### Crypto News API
130
-
131
-
`GET /1/crypto`
132
-
133
-
```
134
-
from newsdataapi import NewsDataApiClient
135
-
136
-
# API key authorization, Initialize the client with your API key
137
-
api = NewsDataApiClient(apikey="API key")
138
-
139
-
# You can pass empty or with request parameters {ex. (country = "us")}
140
-
response = api.crypto_api()
141
-
142
-
```
143
-
`API key` : Your private Newsdata API key.
144
-
145
-
`country` : You can pass a comma seperated string of 2-letter ISO 3166-1 countries (maximum 5) to restrict the search to. Possible Options: `us``gb``in``jp``ae``sa``au``ca``sg`
146
-
147
-
`language` : A comma seperated string of languages (maximum 5) to restrict the search to. Possible Options: `en`, `ar`, `jp`, `in`, `es`, `fr`
148
-
149
-
`domain` : A comma seperated string of domains (maximum 5) to restrict the search to. Use the /domains endpoint to find top sources id.
150
-
151
-
`q` : Keywords or phrases to search for in the news title and content. The value must be URL-encoded. Advance search options: Search Bitcoin q=bitcoin Search "Bitcoin Ethereum" q=bitcoin ethereum Search Bitcoin but not with Ethereum q=bitcoin -ethereum Search Bitcoin but not with Ethereum and Dogecoin bitcoin -ethereum -dogecoin q=bitcoin -ethereum -dogecoin Search multiple keyword with AND operator bitcoin AND ethereum q=bitcoin AND ethereum .
152
-
153
-
`qInTitle` : Keywords or phrases to search for in the news title only.
154
-
155
-
`page` : Use this to page through the results if the total results found is greater than the page size.
156
-
157
-
158
-
<br />
159
-
160
-
### News API with Pagination
161
-
162
-
`GET /1/news`
163
-
164
-
```
165
-
from newsdataapi import NewsDataApiClient
166
-
167
-
# API key authorization, Initialize the client with your API key
168
-
api = NewsDataApiClient(apikey="API key")
169
-
170
-
# You can pass empty or with request parameters {ex. (country = "us")}
171
-
response = api.news_api()
172
-
173
-
# You can go to next page by providing Page parameter
174
-
response = api.news_api(page = "nextPage value")
175
-
176
-
# You can paginate till last page by providing Page parameter in Loop
177
-
page=None
178
-
while True:
179
-
response = api.news_api(page = page)
180
-
page = response.get('nextPage',None)
181
-
if not page:
182
-
break
183
-
184
-
```
185
-
186
-
<br />
187
-
188
32
## License
189
33
190
34
Provided under [MIT License](https://github.com/newsdataapi/python-client/blob/main/LICENSE) by Matt Lisivick.
0 commit comments