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.
Install
Use pip to install the library.
pip install datanews
Usage
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']
print(articles[0]['title'])
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
print(datanews.Monitor.list())
# create new monitor, pass query (list of keywords), and webhook url
monitor = datanews.Monitor.create(query='SpaceX', 'webhook'='https://mywebhook.com')
# 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)
articles.extend(run['articles'])
run_id = run['last_run_id']
done = run_id is None
Metadata
Release files for datanews 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datanews-0.0.7.tar.gz | 3.6 kB | Without provenance | Details for datanews-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datanews-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for datanews-0.0.7-py3-none-any.whl |
Total release size: 8.8 kB
Release files / datanews-0.0.7.tar.gz
| Download URL | datanews-0.0.7.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70ef3d6e58adb8489bd8f9e8e5d257c6cddc3868920f9db55d32592a66db9354
|
|
BLAKE2b-256 checksum How to use checksums |
8fb7678fe7ad4693c8ea12e818e0b91f4c74097a69c922d4315dc826a83414ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.7.4
|
Release files / datanews-0.0.7-py3-none-any.whl
| Download URL | datanews-0.0.7-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
edb1c94373df3211c7de3ddb84eedbd28a0111c005e411ad7ae9598d2282d1bd
|
|
BLAKE2b-256 checksum How to use checksums |
a06117def7528f3d2e07a5df4122f1bea62595bd9e915851dfb3935960442635
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.7.4
|
Security for datanews 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.