Skip to main content

Python client library for Datanews API

Project description

Datanews Python

This is a client library for python 3, built to interact with the Datanews API. You can find full api documentation at official documentation page.


Use pip to install the library.

pip install datanews


To use the API, import the datanews package and provide the api key. Then, proceed to make queries by calling corresponding functions of the library.

Core API

import datanews
datanews.api_key = 'API_KEY'

response = datanews.headlines(q='SpaceX')
articles = response['hits']

Monitoring API

To create monitors use the datanews.Monitor object. To retrieve monitor runs use Monitor.latest function and pass run_id. Each run object has a last_run_id field, which refers to previous run, or None, if no runs were made previously (i.e. this was the first run). Please refer to to full documentation of monitoring API.

import datanews
datanews.api_key = 'API_KEY'

# list all monitors

# create new monitor, pass query (list of keywords), and webhook url
monitor = datanews.Monitor.create(query='SpaceX', 'webhook'='')

# get id of the monitor
id = monitor['id']

# list latest articles from the Monitor
articles = []
run_id = monitor.get('last_run_id', None)
done = run_id is None
while not done:
    run = datanews.Monitor.latest(run_id)
    run_id = run['last_run_id']
    done = run_id is None

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datanews-0.0.7.tar.gz (3.6 kB view hashes)

Uploaded source

Built Distribution

datanews-0.0.7-py3-none-any.whl (5.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page