how to use news api in python code example
Example 1: python news api
from newsapi import NewsApiClient
newsapi = NewsApiClient(api_key='API_KEY')
top_headlines = newsapi.get_top_headlines(q='bitcoin',
sources='bbc-news,the-verge',
category='business',
language='en',
country='us')
all_articles = newsapi.get_everything(q='bitcoin',
sources='bbc-news,the-verge',
domains='bbc.co.uk,techcrunch.com',
from_param='2017-12-01',
to='2017-12-12',
language='en',
sort_by='relevancy',
page=2)
sources = newsapi.get_sources()
Example 2: News API in Python
>>> for data in news.generate():