EnrichmentsMixin#

class EnrichmentsMixin#

Bases: object

Methods Summary

create_enrichment(project_id, type, name, config)

Create a new enrichment on the project.

delete_enrichment(project_id, enrichment_id)

Delete a single enrichment configured on this project.

get_enrichment(project_id, enrichment_id)

Returns a single enrichment configured on this project.

get_enrichments(project_id[, type])

Return enrichments configured on this project.

update_enrichment(project_id, enrichment_id, ...)

Update a single enrichment configured on this project.

Methods Documentation

create_enrichment(project_id, type, name, config, before=None)#

Create a new enrichment on the project.

Parameters
  • project_id – Project identifier. Enrichment will be created in this project.

  • type – Enrichment type. Possible values: pipelet, keyword.

  • name – The new name of the enrichment.

  • config – The configuration of the new enrichment. This is an dictionary and the contents depends on the type.

  • before – The stage before which to run this enrichment (only valid for pipelet enrichments).

Returns

The new enrichment.

Example:

>>> client.create_enrichment('Sz7LLLbyTzy_SddblwIxaA', 'pipelet',
...                          'TextRazor', {
...     'pipelet': 'tenant-example/textrazor',
...     'api_key': 'TextRazor-API-Key'})
{
    u'type': u'pipelet',
    u'config': {u'api_key': u'TextRazor-API-Key',
                u'pipelet': u'tenant-example/textrazor'},
    u'name': u'TextRazor',
    u'id': u'pipelet-rTBoGNl6S4aG4TDkBoN6xQ'
}
delete_enrichment(project_id, enrichment_id)#

Delete a single enrichment configured on this project.

Parameters
  • project_id – Project identifier. Enrichment must exist in this project.

  • enrichment_id – Enrichment identifier.

Example:

>>> client.delete_enrichment('Sz7LLLbyTzy_SddblwIxaA',
...                          'pipelet-rTBoGNl6S4aG4TDkBoN6xQ')
get_enrichment(project_id, enrichment_id)#

Returns a single enrichment configured on this project.

Parameters
  • project_id – Project identifier. Enrichment must exist in this project.

  • enrichment_id – Enrichment identifier.

Example:

>>> client.get_enrichment('Sz7LLLbyTzy_SddblwIxaA',
...                       'pipelet-rTBoGNl6S4aG4TDkBoN6xQ',
...                       'pipelet'})
{
    u'type': u'pipelet',
    u'config': {u'api_key': u'TextRazor-API-Key',
                u'pipelet': u'tenant-example/textrazor'},
    u'name': u'TextRazor',
    u'id': u'pipelet-rTBoGNl6S4aG4TDkBoN6xQ'
}
get_enrichments(project_id, type=None)#

Return enrichments configured on this project.

Parameters
  • project_id – Project identifier. Enrichments are retrieved from this project.

  • type – Type of enlistments to list or None for all types

Example:

>>> client.get_enrichments('Sz7LLLbyTzy_SddblwIxaA', 'pipelet')
[{
    u'type': u'pipelet',
    u'config': {u'api_key': u'TextRazor-API-Key',
                u'pipelet': u'tenant-example/textrazor'},
    u'name': u'TextRazor',
    u'id': u'pipelet-rTBoGNl6S4aG4TDkBoN6xQ'
}]
update_enrichment(project_id, enrichment_id, name, config)#

Update a single enrichment configured on this project.

Parameters
  • project_id – Project identifier. Enrichment must exist in this project.

  • enrichment_id – Enrichment identifier.

  • name – The new name of the enrichment.

  • config – The new configuration of the enrichment. This is an dictionary and the contents depends on the type.

Returns

The modified enrichment.

Example:

>>> client.update_enrichment('Sz7LLLbyTzy_SddblwIxaA',
 'pipelet-rTBoGNl6S4aG4TDkBoN6xQ',
 'TextRazor', {'pipelet': 'tenant-example/textrazor',
 'api_key': 'New-Key'})
{
    u'type': u'pipelet',
    u'config': {
        u'api_key': u'New-Key',
        u'pipelet': u'tenant-example/textrazor'
    },
    u'name': u'TextRazor',
    u'id': u'pipelet-rTBoGNl6S4aG4TDkBoN6xQ'
}