A simple wrapper for the Hivemind API
Project description
Hivemind utility functions
These functions provide lightweight wrappers around the Hivemind API calls.
They handle construction of HTTP requests, pagination of results, and the pairing up of output data with corresponding input data. Apart from that they do nothing complicated at all, and can be used as a template for constructing your own more complicated API calls.
Version history can be viewed at HISTORY.md.
Example usage:
>>> from hivemindutil import hm
>>> hm.help('dataset')
- getDatasetRows(datasetId, baseUrl, apiKey, queries=[])
Returns Dataset Rows for a dataset in the workflows tab. Queries can be supplied as a list of strings where each string defines a (1) key path, (2) logical comparison and (3)value (e.g. "metadata.timestamp=2021-01-01" or "data.path.to.my.key>=0").
- getDatasetRow(datasetId, baseUrl, apiKey, datasetRowId)
Returns a specified row of a dataset.
- deleteDatasetRows(datasetId, baseUrl, apiKey, datasetRowIds=[], allRows=False, raiseForStatus=True)
Deletes specified rows in a dataset. If allRows is set to True, the values passed to datasetRowIds are ignored, and all dataset rows are identified and deleted.
- addDatasetRows(datasetId, baseUrl, apikey, rowsData=[])
Bulk add rows to a dataset. The value of rowsData should be a list of dictionaries of the rows data.
- addDatasetRow(datasetId, baseUrl, apiKey, rowData={})
Add a single row to a dataset. Value for rowData should be the dictionary of the row data object.
>>> r = addDatasetRow(1, 'https://studio.lambda.hvmd.io', 'API-XXXXXXXXXXXXXXXXXXXXXXXX', rowData={'foo': 'bar'})
>>> r
{
'data': {
'datasetRowId': 1,
'datasetId': 1,
'data': {'foo': 'bar'},
'metadata': {'creator': {'id': 0, 'type': 'User'},
'upstream': [],
'timestamp': '2021-08-10T15:26:47.2433333Z',
'sequenceId': 1,
'version': 1
}
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file hivemind_util-0.1b44-py2.py3-none-any.whl
.
File metadata
- Download URL: hivemind_util-0.1b44-py2.py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6f2af343baf82df9b9396ff840c35e224e4880f4bb8b57782d8616cfad57d09 |
|
MD5 | d97b6ac21459c6b9fdae23c1ad03bb2f |
|
BLAKE2b-256 | ab9507d4239a5c599b9803774e5864c9cea1e3c676f8ad69acf41e067843f9e1 |