Skip to main content

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


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

hivemind_util-0.1b44-py2.py3-none-any.whl (12.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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