NewsAPI
Connect to https://newsapi.org/ and get a dataframe
News API – Search News and Blog Articles on the Web
News API
Website

Connect

You must Connect before any other methods
1
naas_drivers.newsapi.connect("YOUR_API_KEY")
2
​
3
# OR You can use our default apikey to test
4
# Limited to 200/hours request for all naas users
5
naas_drivers.newsapi.connect()
Copied!

Get

Basic

1
naas_drivers.newsapi.get(q="TSLA")
Copied!

Fields

Choose fields you want to get in result, list available below:
    title
    image
    link
    description
    source
    image
1
fields = ["image", "title"]
2
naas_drivers.newsapi.get(q="TSLA", fields=fields)
Copied!

Language

Language of news
1
country = "en"
2
data = naas_drivers.newsapi.get(q="TSLA", language=country)
Copied!

Limit

Limit the number of results
1
limit = 5
2
data = naas_drivers.newsapi.get(q="TSLA", limit=limit)
Copied!

Get top news

1
data = naas_drivers.newsapi.get_top(sources='bbc-news')
Copied!

Get sources news

1
sources = naas_drivers.newsapi.get_sources()
Copied!

Official documentation

Endpoints - Documentation - News API
News API