newsapi in python

Solutions on MaxInterview for newsapi in python by the best coders in the world

showing results for - "newsapi in python"
Alberto
25 Apr 2017
1$ pip install newsapi-python
Gaston
02 Apr 2016
1from newsapi import NewsApiClient
2
3# Init
4newsapi = NewsApiClient(api_key='API_KEY')
5
6# /v2/top-headlines
7top_headlines = newsapi.get_top_headlines(q='bitcoin',
8                                          sources='bbc-news,the-verge',
9                                          category='business',
10                                          language='en',
11                                          country='us')
12
13# /v2/everything
14all_articles = newsapi.get_everything(q='bitcoin',
15                                      sources='bbc-news,the-verge',
16                                      domains='bbc.co.uk,techcrunch.com',
17                                      from_param='2017-12-01',
18                                      to='2017-12-12',
19                                      language='en',
20                                      sort_by='relevancy',
21                                      page=2)
22
23# /v2/sources
24sources = newsapi.get_sources()