class squirro_client.topic.TopicApiMixin
Mixing class which encapsulates the functionality of the object API service. See Working with Entities for documentation on the API.
All the methods of this class are made available in the SquirroClient class.
Table of Contents
get_encrypted_query
get_encrypted_query(project_id, query=None, aggregations=None, fields=None, created_before=None, created_after=None, options=None, **kwargs)
Encrypts and signs the query and returns it. If set the aggregations, created_before, created_after, fields and options are part of the encrypted query as well.
Parameters: |
|
---|
For additional parameters see self.query() :returns: A dictionary which contains the encrypted query
Example:
>>> client.get_encrypted_query( '2aEVClLRRA-vCCIvnuEAvQ', query='test_query') {u'encrypted_query': 'YR4h147YAldsARmTmIrOcJqpuntiJULXPV3ZrX_' 'blVWvbCavvESTw4Jis6sTgGC9a1LhrLd9Nq-77CNX2eeieMEDnPFPRqlPGO8V' 'e2rlwuKuVQJGQx3-F_-eFqF-CE-uoA6yoXoPyYqh71syalWFfc-tuvp0a7c6e' 'eKAO6hoxwNbZlb9y9pha0X084JdI-_l6hew9XKZTXLjT95Pt42vmoU_t6vh_w1' 'hXdgUZMYe81LyudvhoVZ6zr2tzuvZuMoYtP8iMcVL_Z0XlEBAaMWAyM5hk_tAG' '7AbqGejZfUrDN3TJqdrmHUeeknpxpMp8nLTnbFMuHVwnj2hSmoxD-2r7BYbolJ' 'iRFZuTqrpVi0='}
query
query(project_id, query=None, aggregations=None, start=None, count=None, fields=None, highlight=None, next_params=None, created_before=None, created_after=None, options=None, encrypted_query=None, **kwargs)
Returns items for the provided project.
This is the successor to the get_items method and should be used in its place.
Parameters: |
|
---|
scan
scan(project_id, query=None, scroll='5m', count=10000, fields=None, highlight=None, created_before=None, created_after=None, options=None, encrypted_query=None)
Returns an iterator to scan through all items of a project.
Note: For smartfilter queries this still returns at maximum 10000 results.
Parameters: |
|
---|---|
Returns: | An iterator over all (matching) items. |
Open issues/current limitations:
- ensure this works for encrypted queries too.
- support fold_near_duplicate option
- support smart filter queries with more than 10k results
get_items
get_items(project_id, **kwargs)
Returns items for the provided project.
Parameters: |
|
---|---|
Returns: | A dictionary which contains the items for the project. |
Example:
>>> client.get_items('2aEVClLRRA-vCCIvnuEAvQ', count=1) {u'count': 1, u'eof': False, u'items': [{u'created_at': u'2012-10-06T08:27:58', u'id': u'haG6fhr9RLCm7ZKz1Meouw', u'link': u'https://www.youtube.com/watch?v=Zzvhu42dWAc&feature=youtube_gdata', u'read': True, u'item_score': 0.5, u'score': 0.56, u'sources': [{u'id': u'oMNOQ-3rQo21q3UmaiaLHw', u'link': u'https://gdata.youtube.com/feeds/api/users/mymemonic/uploads', u'provider': u'feed', u'title': u'Uploads by mymemonic'}, {u'id': u'H4nd0CasQQe_PMNDM0DnNA', u'link': None, u'provider': u'savedsearch', u'title': u'Squirro Alerts for "memonic"'}], u'starred': False, u'thumbler_url': u'22327aa6b6f4d2492346bed39ae354c0e94bf804/thumb/trunk/6f/87/f9/6f87f929773bd941d4a84209604ed014c7a21d7d.jpg', u'title': u'Web Clipping - made easy with Memonic', u'objects': [], u'webshot_height': 360, u'webshot_url': u'http://webshot.trunk.cluster.squirro.net.s3.amazonaws.com/6f/87/f9/6f87f929773bd941d4a84209604ed014c7a21d7d.jpg', u'webshot_width': 480}], u'now': u'2012-10-11T14:39:54'}
get_item
get_item(project_id, item_id, **kwargs)
Returns the requested item for the provided project.
Parameters: |
|
---|---|
Returns: | A dictionary which contains the individual item. |
Example:
>>> client.get_item('2aEVClLRRA-vCCIvnuEAvQ', 'haG6fhr9RLCm7ZKz1Meouw') {u'item': {u'created_at': u'2012-10-06T08:27:58', u'id': u'haG6fhr9RLCm7ZKz1Meouw', u'link': u'https://www.youtube.com/watch?v=Zzvhu42dWAc&feature=youtube_gdata', u'read': True, u'item_score': 0.5, u'score': 0.56, u'sources': [{u'id': u'oMNOQ-3rQo21q3UmaiaLHw', u'link': u'https://gdata.youtube.com/feeds/api/users/mymemonic/uploads', u'provider': u'feed', u'title': u'Uploads by mymemonic'}, {u'id': u'H4nd0CasQQe_PMNDM0DnNA', u'link': None, u'provider': u'savedsearch', u'title': u'Squirro Alerts for "memonic"'}], u'starred': False, u'thumbler_url': u'22327aa6b6f4d2492346bed39ae354c0e94bf804/thumb/trunk/6f/87/f9/6f87f929773bd941d4a84209604ed014c7a21d7d.jpg', u'title': u'Web Clipping - made easy with Memonic', u'objects': [], u'webshot_height': 360, u'webshot_url': u'http://webshot.trunk.cluster.squirro.net.s3.amazonaws.com/6f/87/f9/6f87f929773bd941d4a84209604ed014c7a21d7d.jpg', u'webshot_width': 480}}
modify_item
modify_item(project_id, item_id, star=None, read=None, keywords=None)
Updates the flags and keywords of an item.
Parameters: |
|
---|
Example:
>>> client.modify_item('2aEVClLRRA-vCCIvnuEAvQ', 'haG6fhr9RLCm7ZKz1Meouw', star=True, read=False, keywords={'Canton': ['Berne'], 'Topic': None})
delete_item
delete_item(project_id, item_id, object_ids=None)
Deletes an item. If object_ids is provided the item gets not deleted but is de-associated from these objects.
Parameters: |
|
---|
Example:
>>> client.delete_item('2aEVClLRRA-vCCIvnuEAvQ', 'haG6fhr9RLCm7ZKz1Meouw', object_ids=['object01'])
get_typeahead_suggestions
get_typeahead_suggestions(project_id, searchbar_query, cursor_pos, max_suggestions=None, options=None)
Get the typeahead suggestions for a query searchbar_query in the project identified by the id project_id.
Parameters: |
|
---|---|
Returns: | A dict of suggestions |
Example:
>>> client.get_typeahead_suggestions( project_id='Sz7LLLbyTzy_SddblwIxaA', 'searchbar_query='Country:India c', 'cursor_pos'=15) {u'suggestions': [{ u'type': u'facetvalue', u'key': u'Country:India City:Calcutta', u'value': u'city:Calcutta', 'score': 12, 'cursor_pos': 26, 'group': 'country'}, {u'type': u'facetvalue', u'key': u'Country:India Name:Caesar', u'value': u'name:Caesar', 'score': 8, 'cursor_pos': 24, 'group': 'country'}, {u'type': u'facetname', u'key': u'Country:India city:', u'value': u'City', 'score': 6, 'cursor_pos': 19, 'group': 'Fields'}]}
get_user_objects
get_user_objects(project_id, full=None, start=None, count=None, api_version='v0')
Get all objects for the provided user.
Parameters: |
|
---|---|
Returns: | A list which contains the objects. |
Example:
>>> client.get_user_objects(project_id='Sz7LLLbyTzy_SddblwIxaA', api_version='v1') {u'count': 100, u'start': 0, u'next_params': {u'count': 100, u'start': 100} u'objects':[{u'project_id': u'Sz7LLLbyTzy_SddblwIxaA', u'id': u'zFe3V-3hQlSjPtkIKpjkXg', u'is_ready': True, u'needs_preview': False, u'noise_level': None, u'title': u'Alexander Sennhauser', u'type': u'contact'}]}
get_object
get_object(project_id, object_id)
Get object details.
Parameters: |
|
---|---|
Returns: | A dictionary which contains the object. |
Example:
>>> client.get_object('2aEVClLRRA-vCCIvnuEAvQ', '2sic33jZTi-ifflvQAVcfw') {u'project_id': u'2aEVClLRRA-vCCIvnuEAvQ', u'id': u'2sic33jZTi-ifflvQAVcfw', u'is_ready': True, u'managed_subscription': False, u'needs_preview': False, u'noise_level': None, u'subscriptions': [u'3qTRv4W9RvuOxcGwnnAYbg', u'hw8j7LUBRM28-jAellgQdA', u'4qBkea4bTv-QagNS76_akA', u'NyfRri_2SUa_JNptx0JAnQ', u'oTvI6rlaRmKvmYCfCvLwpw', u'c3aEwdz5TMefc_u7hCl4PA', u'Xc0MN_7KTAuDOUbO4mhG6A', u'y1Ur-vLuRmmzUNMi4xGrJw', u'iTdms4wgTRapn1ehMqJgwA', u'MawimNPKSlmpeS9YlMzzaw'], u'subscriptions_processed': True, u'title': u'Squirro', u'type': u'organization'}
new_object
new_object(project_id, title, owner_id=None, type=None, is_ready=None)
Create a new object.
Parameters: |
|
---|---|
Returns: | A dictionary which contains the project identifier and the new object identifier. |
Example:
>>> client.new_object('H5Qv-WhgSBGW0WL8xolSCQ', '2aEVClLRRA-vCCIvnuEAvQ', 'Memonic', type='organization') {u'project_id': u'2aEVClLRRA-vCCIvnuEAvQ', u'id': u'2TBYtWgRRIa23h1rEveI3g'}
modify_object
modify_object(project_id, object_id, title=None, is_ready=None, noise_level=None)
Modify an object.
Parameters: |
|
---|---|
Returns: | A dictionary which contains the object. |
Example:
>>> client.modify_object('2aEVClLRRA-vCCIvnuEAvQ', '2TBYtWgRRIa23h1rEveI3g', is_ready=False) {}
delete_object
delete_object(project_id, object_id)
Delete a object.
Parameters: |
|
---|
Example:
>>> client.delete_object('2aEVClLRRA-vCCIvnuEAvQ', '2TBYtWgRRIa23h1rEveI3g')
pause_object
pause_object(project_id, object_id, subscription_ids=None)
Pause all (or some) subscriptions of an object.
Parameters: |
|
---|
Example:
>>> client.pause_object('2aEVClLRRA-vCCIvnuEAvQ', '2TBYtWgRRIa23h1rEveI3g')
resume_object
resume_object(project_id, object_id, subscription_ids=None)
Resume all (or some) paused subscriptions of an object.
Parameters: |
|
---|
Example:
>>> client.resume_object('2aEVClLRRA-vCCIvnuEAvQ', '2TBYtWgRRIa23h1rEveI3g')
get_user_projects
get_user_projects(owner_id=None, include_objects=False)
Get projects for the provided user.
Parameters: |
|
---|---|
Returns: | A list of projects. |
Example:
>>> client.get_user_projects() [{u'id': u'Sz7LLLbyTzy_SddblwIxaA', u'title': u'My Contacts', u'objects': 1, u'type': u'my contacts'}, {u'id': u'2aEVClLRRA-vCCIvnuEAvQ', u'title': u'My Organizations', u'objects': 2, u'type': u'my organizations'}]
get_project
get_project(project_id)
Get project details.
Parameters: | project_id – Project identifier. |
---|---|
Returns: | A dictionary which contains the project. |
Example:
>>> client.get_project('2aEVClLRRA-vCCIvnuEAvQ') {u'id': u'2aEVClLRRA-vCCIvnuEAvQ', u'title': u'My Organizations', u'type': u'my organizations'}
new_project
new_project(title, owner_id=None, locator=None, default_sort=None)
Create a new project.
Parameters: |
|
---|---|
Returns: | A dictionary which contains the project identifier. |
Example:
>>> locator = {'index_server': 'http://10.0.0.1:9200'} >>> default_sort = [{'relevance': {'order': 'asc'}}] >>> client.new_project('My Project', locator=locator, default_sort=default_sort) {u'id': u'gd9eIipOQ-KobU0SwJ8VcQ'}
modify_project
modify_project(project_id, **kwargs)
Modify a project.
Parameters: |
|
---|
Example:
>>> client.modify_project('gd9eIipOQ-KobU0SwJ8VcQ', title='My Other Project')
delete_project
delete_project(project_id)
Delete a project.
Parameters: | project_id – Project identifier. |
---|
Example:
>>> client.delete_project('gd9eIipOQ-KobU0SwJ8VcQ')
reset_project
reset_project(project_id, reset_dashboards=None, reset_elasticsearch_index=None, reset_facets=None)
Resets different entities of a project based on boolean flags.
Parameters: |
|
---|
Example:
>>> client.reset_project( 'gd9eIipOQ-KobU0SwJ8VcQ', reset_dashboards=True, reset_elasticsearch_index=True, reset_facets=True)
get_object_subscriptions
get_object_subscriptions(project_id, object_id, user_id=None, filter_deleted=None)
Get all subscriptions for the provided object.
Parameters: |
|
---|---|
Returns: | A list which contains subscriptions. |
Example:
>>> client.get_object_subscriptions('2sic33jZTi-ifflvQAVcfw', '2TBYtWgRRIa23h1rEveI3g') [ { u'config': { u'market': u'de-CH', u'query': u'squirro', u'vertical': u'News', }, u'deleted': False, u'id': u'hw8j7LUBRM28-jAellgQdA', u'link': u'http://bing.com/news/search?q=squirro', u'modified_at': u'2012-10-09T07:54:12', u'provider': u'bing', u'seeder': None, u'source_id': u'2VkLodDHTmiMO3rlWi2MVQ', u'title': u'News Alerts for "squirro" in Switzerland', } ]
get_subscription
get_subscription(project_id, object_id, subscription_id)
Get subscription details.
Parameters: |
|
---|---|
Returns: | A dictionary which contains the subscription. |
Example:
>>> client.get_subscription('2sic33jZTi-ifflvQAVcfw', '2TBYtWgRRIa23h1rEveI3g', 'hw8j7LUBRM28-jAellgQdA') { u'config': { u'market': u'de-CH', u'query': u'squirro', u'vertical': u'News', }, u'deleted': False, u'id': u'hw8j7LUBRM28-jAellgQdA', u'link': u'http://bing.com/news/search?q=squirro', u'modified_at': u'2012-10-09T07:54:12', u'provider': u'bing', u'seeder': None, u'source_id': u'2VkLodDHTmiMO3rlWi2MVQ', u'title': u'News Alerts for "squirro" in Switzerland', u'processed': True, u'paused': False, }
new_subscription
new_subscription(project_id, object_id, provider, config, user_id=None, seeder=None, private=None)
Create a new subscription.
Parameters: |
|
---|---|
Returns: | A dictionary which contains the new subscription. |
Example:
>>> client.new_subscription('2sic33jZTi-ifflvQAVcfw', '2TBYtWgRRIa23h1rEveI3g', 'feed', {'url': 'http://blog.squirro.com/rss'}) {u'config': {u'url': u'http://blog.squirro.com/rss'}, u'deleted': False, u'id': u'oTvI6rlaRmKvmYCfCvLwpw', u'link': u'http://blog.squirro.com/rss', u'modified_at': u'2012-10-12T09:32:09', u'provider': u'feed', u'seeder': u'team', u'source_id': u'D3Q8AiPoTg69bIkqFhe3Bw', u'title': u'Squirro', u'processed': False, u'paused': False}
modify_subscription
modify_subscription(project_id, object_id, subscription_id, config=None)
Modify an existing subscription.
Parameters: |
|
---|
Example:
>>> client.modify_subscription('2sic33jZTi-ifflvQAVcfw', '2TBYtWgRRIa23h1rEveI3g', 'oTvI6rlaRmKvmYCfCvLwpw', config={'url': 'http://blog.squirro.com/atom'})
delete_subscription
delete_subscription(project_id, object_id, subscription_id, seeder=None)
Delete an existing subscription.
Parameters: |
|
---|
Example:
>>> client.delete_subscription('2sic33jZTi-ifflvQAVcfw', '2TBYtWgRRIa23h1rEveI3g', 'oTvI6rlaRmKvmYCfCvLwpw')
pause_subscription
pause_subscription(project_id, object_id, subscription_id)
Pause a subscription.
Parameters: |
|
---|
Example:
>>> client.pause_subscription('2sic33jZTi-ifflvQAVcfw', '2TBYtWgRRIa23h1rEveI3g', 'hw8j7LUBRM28-jAellgQdA')
resume_subscription
resume_subscription(project_id, object_id, subscription_id)
Resume a paused subscription.
Parameters: |
|
---|
Example:
>>> client.resume_subscription('2sic33jZTi-ifflvQAVcfw', '2TBYtWgRRIa23h1rEveI3g', 'hw8j7LUBRM28-jAellgQdA')
get_object_signals
get_object_signals(project_id, object_id, flat=False)
Return a dictionary of object signals for a object.
Parameters: |
|
---|---|
Returns: | Dictionary of signals on this object. |
Example:
>>> client.get_object_signals('gd9eIipOQ-KobU0SwJ8VcQ', '2sic33jZTi-ifflvQAVcfw') {'signals': [{u'key': u'email_domain', u'value': 'nestle.com', u'seeder': 'salesforce'}]} >>> client.get_object_signals('gd9eIipOQ-KobU0SwJ8VcQ', '2sic33jZTi-ifflvQAVcfw', flat=True) {u'email_domain': 'nestle.com'}
update_object_signals
update_object_signals(project_id, object_id, signals, seeder=None, flat=False)
Updates the object signals of a object.
Parameters: |
|
---|---|
Returns: | List or dictionary of all signals of that object in the same format as returned by get_object_signals. |
Example:
>>> client.update_object_signals('gd9eIipOQ-KobU0SwJ8VcQ', '2sic33jZTi-ifflvQAVcfw', [{'key': 'essentials', 'value': ['discovery-baseobject-A96PWkLzTIWSJy3WMsvzzw']}]) [ {u'key': u'essentials', u'value': [u'discovery-baseobject-A96PWkLzTIWSJy3WMsvzzw'], u'seeder': None}, {u'key': u'email_domain', u'value': 'nestle.com', u'seeder': 'salesforce'} ] >>> client.update_object_signals('gd9eIipOQ-KobU0SwJ8VcQ', '2sic33jZTi-ifflvQAVcfw', {'essentials': ['discovery-baseobject-A96PWkLzTIWSJy3WMsvzzw']}, flat=True) {u'essentials': [u'discovery-baseobject-A96PWkLzTIWSJy3WMsvzzw'], u'email_domain': u'nestle.com'}
get_preview
get_preview(project_id, provider, config)
Preview the provider configuration.
Parameters: |
|
---|---|
Returns: | A dictionary which contains the provider preview items. |
Example:
>>> client.get_preview('feed', {'url': ''}) {u'count': 2, u'items': [{u'created_at': u'2012-10-01T20:12:07', u'id': u'F7EENNQeTz2z7O7htPACgw', u'link': u'http://blog.squirro.com/post/32680369129/swisscom-features-our-sister-product-memonic-in-its-all', u'read': False, u'item_score': 0, u'score': 0, u'starred': False, u'thumbler_url': u'd486ac63fc3490b42ce044feba7b71b18cb84061/thumb/trunk/57/cd/10/57cd10d6e0163a7e068370d91f14ed0e46dca085.jpg', u'title': u'Swisscom features our sister product Memonic in its all new App Store', u'webshot_height': 237, u'webshot_url': u'http://webshot.trunk.cluster.squirro.net.s3.amazonaws.com/57/cd/10/57cd10d6e0163a7e068370d91f14ed0e46dca085.jpg', u'webshot_width': 600}, {u'created_at': u'2012-09-25T08:09:24', u'id': u'Nrj308UNTEixra3qTYLn7w', u'link': u'http://blog.squirro.com/post/32253089480/247-million-emails-are-sent-every-day-80-are', u'read': False, u'item_score': 0, u'score': 0, u'starred': False, u'thumbler_url': u'b4269d64a8b5993678a33a68ea013e1e8875bc67/thumb/trunk/ca/24/f2/ca24f263eb044e8ed3bc5135ab7d56112cb8206a.jpg', u'title': u'247 million emails are sent every day - 80% are spam.\nPeople...', u'webshot_height': 360, u'webshot_url': u'http://webshot.trunk.cluster.squirro.net.s3.amazonaws.com/ca/24/f2/ca24f263eb044e8ed3bc5135ab7d56112cb8206a.jpg', u'webshot_width': 480}]}
new_savedsearch
new_savedsearch(scope_type, scope_id, query, name=None, actions=None, created_before=None, created_after=None, relative_start=None, relative_end=None, dashboard_id=None)
Create a new saved search.
Parameters: |
|
---|---|
Returns: | A dictionary with created saved search. |
Example:
>>> client.new_savedsearch( scope_id='2sic33jZTi-ifflvQAVcfw', scope_type='project', query='hello world', ) {u'actions': [{u'id': u'678b8102e5c55683130a469c12f6ce55a97ab8b5', u'type': u'show'}], u'id': u'1ba32747c302d1c3cd4f2d43cfe937d7ae64489b', u'query': u'hello world'}
modify_savedsearch
modify_savedsearch(savedsearch_id, scope_type, scope_id, query, name=None, actions=None, created_before=None, created_after=None, relative_start=None, relative_end=None)
Modify a saved search.
Parameters: |
|
---|---|
Returns: | A dictionary with updated saved search data. |
Example:
>>> client.modify_savedsearch( savedsearch_id='77e2bbb206527a2e1ff2e5baf548656a8cb999cc', scope_id='2sic33jZTi-ifflvQAVcfw', scope_type='project', query='test me' ) {u'actions': [{u'id': u'4e23249793e9a3df2126321109c6619df66aaa51', u'type': u'show'}], u'id': u'77e2bbb206527a2e1ff2e5baf548656a8cb999cc', u'query': u'test me'}
get_savedsearches
get_savedsearches(scope_type, scope_id)
Get saved searches for the provided scope.
Parameters: |
|
---|---|
Returns: | A dictionary with data for the saved searches. |
Example:
>>> client.get_savedsearches(scope_type='project', scope_id='2sic33jZTi-ifflvQAVcfw') {u'savedsearches': [{u'actions': [{u'id': u'ff18180f74ebdf4b964ac8b5dde66531e0acba83', u'type': u'show'}], u'id': u'9c2d1a9002a8a152395d74880528fbe4acadc5a1', u'query': u'hello world', u'relative_start': '24h', u'relative_end': None, u'created_before': None, u'created_after': None}]}
get_savedsearch
get_savedsearch(scope_type, scope_id, savedsearch_id)
Get saved search details.
Parameters: |
|
---|---|
Returns: | A dictionary with saved search data. |
Example:
>>> client.get_savedsearch(scope_type='project', scope_id='2sic33jZTi-ifflvQAVcfw', savedsearch_id='77e2bbb206527a2e1ff2e5baf548656a8cb999cc') {u'actions': [{u'id': u'4e23249793e9a3df2126321109c6619df66aaa51', u'type': u'show'}], u'id': u'77e2bbb206527a2e1ff2e5baf548656a8cb999cc', u'query': u'test me', u'relative_start': '24h', u'relative_end': None, u'created_before': None, u'created_after': None}
delete_savedsearch
delete_savedsearch(scope_type, scope_id, savedsearch_id)
Delete a savedsearch.
Parameters: |
|
---|
Example:
>>> client.delete_savedsearch(scope_type='project', scope_id='2sic33jZTi-ifflvQAVcfw', savedsearch_id='9c2d1a9002a8a152395d74880528fbe4acadc5a1')
new_trenddetection
new_trenddetection(project_id, name, query, email_user, aggregation_interval, aggregation_field=None, aggregation_method=None, aggregation_time_field=None)
Create a new trend detection.
Parameters: |
|
---|
Example:
>>> client.new_trenddetection( project_id='2sic33jZTi-ifflvQAVcfw', query='hello world', name='test name', email_user='test@squirro.com', aggregation_interval='1w', aggregation_field='votes', aggregation_method='avg', aggregation_time_field='my_datetime_facet' ) { u'created_at': u'2016-02-23T16:28:00', u'id': u'iR81vxDnShu5di4snCu6Jg', u'modified_at': u'2016-02-23T16:28:00', u'name': u'test name', u'project_id': u'2sic33jZTi-ifflvQAVcfw', u'query': u'hello world' u'aggregation_interval': u'1w', u'aggregation_field': u'votes', u'aggregation_method': u'avg', u'aggregation_time_field': u'my_datetime_facet' }
get_trenddetections
get_trenddetections(project_id)
Get details of all the trend detections on a particular project.
Parameters: | project_id – Id of the project. |
---|---|
Returns: | A dictionary with all the Trend Detection Entities. |
Example:
>>> client.get_trenddetections(project_id='2sic33jZTi-ifflvQAVcfw') { u'trend_detection_entities': [ { u'created_at': '2016-02-09T08:34:17', u'id': 'nwBnJ5tkQVGMjKFUBZ1Cbw', u'modified_at': '2016-02-09T08:34:19', u'name': 'test_tde', u'project_id': 'oFFPR28pTUOkmUF8pZO0cA', u'query': '', u'aggregation_interval': u'1w', u'aggregation_field': u'votes', u'aggregation_method': u'avg', u'aggregation_time_field': u'my_datetime_facet' } ] }
get_trenddetection
get_trenddetection(project_id, trenddetection_id, include_trend_detection_entity=None, include_thresholds=None, include_anomalies=None, include_predictions=None, result_before=None, result_after=None)
Get details for a particular trend detection entity.
Parameters: |
|
---|---|
Returns: | A dictionary with the requested Trend Detection Entity and various data-attributes based on the boolean flags. |
Example:
>>> client.get_trenddetection(project_id='oFFPR28pTUOkmUF8pZO0cA', trenddetection_id='nwBnJ5tkQVGMjKFUBZ1Cbw', include_trend_detection_entity=True, include_thresholds=False, include_anomalies=False, include_predictions=False) { u'created_at': u'2016-02-09T08:34:17', u'id': u'nwBnJ5tkQVGMjKFUBZ1Cbw', u'modified_at': u'2016-02-09T08:34:19', u'name': u'test name', u'project_id': u'oFFPR28pTUOkmUF8pZO0cA', u'query': u'test_query', u'aggregation_interval': u'1w', u'aggregation_field': u'votes', u'aggregation_method': u'avg', u'aggregation_time_field': u'my_datetime_facet' }
delete_trenddetection
delete_trenddetection(project_id, trenddetection_id)
Delete a particular Trend Detection Entity.
Parameters: |
|
---|
Example:
>>> client.delete_trenddetection(project_id='2sic33jZTi-ifflvQAVcfw', trenddetection_id='fd5x9NIqQbyBmF4Yph9MMw')
get_trenddetection_result
get_trenddetection_result(project_id, trenddetection_id, result_before=None, result_after=None, include_thresholds=True, include_anomalies=True, include_historical_data=True, include_trend_detection_entity=True, include_predictions=False)
Mostly a wrapper around get_trenddetection method to maintain backwards compatibility. Will be deprecated with the next release. Please use the get_trenddetection method. Returns predictions, anomalies, thresholds and the underlying data values of a trend detection entity.
Parameters: |
|
---|---|
Returns: | A dict of the trend detection entity, its underlying data values, its calculated threshold, anomalies and predictions. |
Example:
>>> client.get_trenddetection_result(project_id='2sic33jZTi-ifflvQAVcfw', trenddetection_id='fd5x9NIqQbyBmF4Yph9MMw', include_predictions=True) { 'thresholds': [ {u'count': 18.709624304, u'timestamp': u'2016-01-25T00:00:00'}, {u'count': 17.6339240561, u'timestamp': u'2016-02-01T00:00:00'}, {u'count': 16.6033921677, u'timestamp': u'2016-02-08T00:00:00'}, {u'count': 17.5181532055, u'timestamp': u'2016-02-15T00:00:00'} ], 'historical_values': { u'values': [ {u'value': 18, u'key': u'2016-01-25T00:00:00'}, {u'value': 5, u'key': u'2016-02-01T00:00:00'}, {u'value': 7, u'key': u'2016-02-08T00:00:00'}, {u'value': 4, u'key': u'2016-02-15T00:00:00'}], u'interval_seconds': 604800.0, u'interval_logical': False}, 'trend_detection_entity': { u'aggregation_time_field': u'$item_created_at', u'aggregation_field': None, u'name': u'test_client', u'created_at': u'2016-05-04T09:03:55', u'modified_at': u'2016-05-04T09:03:58', u'aggregation_interval': u'1w', u'aggregation_method': None, u'query': u'', u'project_id': u'ZjI9KK3zRTaMkYSzUL6Ehw', u'id': u'lsXDwwErQkq7dGKDaRopQQ' }, 'anomalies': [u'2016-01-25T00:00:00'], 'predictions': [ { u'timestamp': u'2016-02-22T00:00:00', u'prediction_value': 8.3735121811, u'prediction_threshold': 11.5988725339 }, { u'timestamp': u'2016-02-29T00:00:00', u'prediction_value': 11.8071893366, u'prediction_threshold': 13.011517576 }, { u'timestamp': u'2016-03-07T00:00:00', u'prediction_value': 6.4798976922, u'prediction_threshold': 11.8167726387 } ] }
get_project_fingerprints
get_project_fingerprints(project_id, tags=None, include_config=False)
Get all fingerprints which are applicable on a object.
Parameters: |
|
---|---|
Returns: | A list of fingerprints. |
Example:
>>> client.get_project_fingerprints('zgxIdCxSRWSwJzL1fwNX1Q') []
get_fingerprint
get_fingerprint(type, type_id, name)
Get a single fingerprint for the provided parameters.
Parameters: |
|
---|---|
Returns: | Fingerprint information in a dictionary. |
Example:
>>> client.get_fingerprint('object', 'zgxIdCxSRWSwJzL1fwNX1Q', 'default') {}
get_project_fingerprint_scores
get_project_fingerprint_scores(project_id, tags, object_id=None, fields=None)
Get the fingerprint scores for all items contained in the specified project. One ore more fingerprints are selected by specifying tags.
Parameters: |
|
---|---|
Returns: | A list of fingerprint score entries. |
Example:
>>> client.get_project_fingerprint_scores('Sz7LLLbyTzy_SddblwIxaA', ['poc', 'testing']) [{u'fingerprint': {u'filter_min_score': None, u'name': u'ma', u'title': u'', u'type': u'tenant', u'type_id': u'squirro'}, u'scores': [{u'fields': {u'external_id': u'a38515'}, u'noise_level': 0.0}, {u'fields': {u'external_id': u'a37402'}, u'noise_level': 0.0}, {u'fields': {u'external_id': u'a38116'}, u'noise_level': 0.1}]}, {u'fingerprint': {u'filter_min_score': 1.2950184, u'name': u'something', u'title': u'Something', u'type': u'tenant', u'type_id': u'squirro'}, u'scores': [{u'fields': {u'external_id': u'a38515'}, u'noise_level': 0.0}, {u'fields': {u'external_id': u'a37402'}, u'noise_level': 0.1}, {u'fields': {u'external_id': u'a38116'}, u'noise_level': 0.1}]}]
validate_fingerprint_attributes
validate_fingerprint_attributes(data)
Validates the attributes syntax of a fingerprint.
Parameters: | data – Fingerprint attributes. |
---|
Valid example:
>>> data = {'config': { 'manual_features': 'term1, 1.5, de, Term1\nterm2, 2.4', 'default_manual_features_lang': 'de'}} >>> client.validate_fingerprint_attributes(data) {}
Invalid example:
>>> data = {'config': { 'manual_features': 'invalid, 1.5, de, Term1'}} >>> try: >>> client.validate_fingerprint_attributes(data) >>> except squirro_client.exceptions.ClientError as e: >>> print e.error u'[{"line": 0, "error": "required default language is missing"}]'
new_fingerprint
new_fingerprint(type, type_id, name=None, data=None)
Create a new fingerprint for the provided parameters.
Parameters: |
|
---|
Example:
>>> data = {'title': 'Earnings Call'} >>> client.new_fingerprint('user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data) {}
copy_fingerprint
copy_fingerprint(type, type_id, name)
Copies the fingerprint for the provided parameters.
Parameters: |
|
---|
Example:
>>> client.copy_fingerprint('tenant', 'squirro', 'ma') {}
update_fingerprint_from_content
update_fingerprint_from_content(type, type_id, name, content)
Updates the fingerprint for the provided parameters from content data.
Parameters: |
|
---|
Example:
>>> data = [{'lang': 'en', 'text': 'english content'}] >>> client.update_fingerprint_from_content('user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data) {}
update_fingerprint_from_baseobject
update_fingerprint_from_baseobject(type, type_id, name, baseobject)
Updates the fingerprint for the provided parameters from base object data.
Parameters: |
|
---|
Example:
>>> data = ['tK0W2Q8SR9uvSn3AlB9DLg'] >>> client.update_fingerprint_from_baseobject('user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data) {}
update_fingerprint_from_items
update_fingerprint_from_items(type, type_id, name, items, negative=False)
Updates the fingerprint for the provided parameters from items data.
Parameters: |
|
---|
Example:
>>> data = ['tfoOHGEZRAqFURaEE2cPWA'] >>> client.update_fingerprint_from_items('user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data) {}
update_fingerprint_attributes
update_fingerprint_attributes(type, type_id, name, data)
Updates the fingerprint key-value attributes for the provided parameters.
Parameters: |
|
---|
Example:
>>> data = {'title': 'Earnings Call'} >>> client.update_fingerprint_attributes('user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data)
delete_fingerprint
delete_fingerprint(type, type_id, name)
Deletes the fingerprint for the provided parameters.
Parameters: |
|
---|
Example:
>>> client.delete_fingerprint('user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default')
move_fingerprint
move_fingerprint(type, type_id, name, target_name)
Moves the fingerprint for the provided parameters.
This saves the fingerprint and removes the temporary flag. The old fingerprint is not removed.
Parameters: |
|
---|
Example:
>>> client.move_fingerprint('user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default')
protect_fingerprint
protect_fingerprint(type, type_id, name, locked)
Sets the locked state of a fingerprint.
Parameters: |
|
---|
Example:
>>> client.protect_fingerprint('user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', True)
get_fingerprint_matches_for_query
get_fingerprint_matches_for_query(type, type_id, name, language, noise_level=0.1, **kwargs)
Returns the match counts for each feature of fingerprint with type, type_id and name and the query provide in kwargs.
Parameters: |
|
---|---|
Returns: | A dictionary which contains the matching feature and counts for the query. |
delete_contributing_content_record
delete_contributing_content_record(type, type_id, name, record_id, created_at=None)
Deletes a contributing content record and recalculates the fingerprint for the provided parameters.
Parameters: |
|
---|
Example:
>>> client.delete_contributing_content_record('user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', 'M2uyX6aUQVG2J2zcblSFHg') {}
update_contributing_content_record
update_contributing_content_record(type, type_id, name, record_id, content, created_at=None)
Updates a contributing content record and recalculates the fingerprint for the provided parameters.
Parameters: |
|
---|
Example:
>>> data = {'lang': 'en', 'text': 'updated english content'} >>> client.update_fingerprint_from_content('user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', 'M2uyX6aUQVG2J2zcblSFHg', data, created_at='2013-07-01T14:08:23') {}
delete_contributing_baseobject_record
delete_contributing_baseobject_record(type, type_id, name, record_id, created_at=None)
Deletes a contributing base object record and recalculates the fingerprint for the provided parameters.
Parameters: |
|
---|
Example:
>>> client.delete_contributing_baseobject_record('user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', 'sPOUuXqgSXqSllVkzheLvw') {}
delete_contributing_items_record
delete_contributing_items_record(type, type_id, name, record_id, created_at=None)
Deletes a contributing items record and recalculates the fingerprint for the provided parameters.
Parameters: |
|
---|
Example:
>>> client.delete_contributing_items_record('user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', '0L5jwLdfTJWRcTFMtBzhGg') {}
get_tasks
get_tasks()
Return a list of all scheduled tasks for the current user.
get_task
get_task(task_id)
Return details for a scheduled task.
Parameters: | task_id – Task identifier. |
---|
create_task
create_task(**params)
Create a scheduled task. All parameters are passed on as attributes to create.
update_task
update_task(task_id, **params)
Update a scheduled task. All parameters are passed on as attributes to update.
Parameters: | task_id – Task identifier. |
---|
delete_task
delete_task(task_id)
Delete a scheduled task.
Parameters: | task_id – Task identifier. |
---|
get_projects
get_projects()
Return all projects.
get_dashboards
get_dashboards(project_id)
Return all dashboard for the given project.
Parameters: | project_id – Project identifier |
---|---|
Returns: | A list of dashboard dictionaries. |
Example:
>>> client.get_dashboards('2aEVClLRRA-vCCIvnuEAvQ') [{u'id': u'G0Tm2SQcTqu2d4GvfyrsMg', u'search': {u'query': u'Test'}, u'title': u'Test', u'type': u'dashboard', u'widgets': [{u'col': 1, u'id': 1, u'row': 1, u'size_x': 1, u'size_y': 1, u'title': u'Search Results', u'type': u'Search'}]}]
get_dashboard
get_dashboard(project_id, dashboard_id)
Return a specific dashboard from the given project.
Parameters: |
|
---|---|
Returns: | A dictionary of the given dashboard. |
Example:
>>> client.get_dashboard('2aEVClLRRA-vCCIvnuEAvQ', 'G0Tm2SQcTqu2d4GvfyrsMg') {u'id': u'G0Tm2SQcTqu2d4GvfyrsMg', u'search': {u'query': u'Test'}, u'title': u'Test', u'type': u'dashboard', u'theme_id': u'G0Tm2SQcTqu2d4GvfyrsMg', u'widgets': [{u'col': 1, u'id': 1, u'row': 1, u'size_x': 1, u'size_y': 1, u'title': u'Search Results', u'type': u'Search'}]}
new_dashboard
new_dashboard(project_id, title, search=None, type=None, column_count=None, row_height=None, theme_id=None, hide_title=None, reset_placement=None, sections=None, sidepanel=None, loaders=None)
Create a new dashboard.
Parameters: |
|
---|---|
Returns: | A list of dashboard dictionaries. |
Example:
>>> client.new_dashboard('2aEVClLRRA-vCCIvnuEAvQ', title='Sample') {u'column_count': 16, u'hide_title': False, u'id': u'8N38s1XsTAKE39TFC4kTkg', u'reset_placement': u'right', u'row_height': 55, u'search': None, u'sections': [], u'sidepanel': False, u'theme': { u'definition': { u'activeColor': u'#e55100', u'background': u'#ffffff', u'borderColor': u'#BDBDBD', u'borderRadius': 2, u'headerHeight': 30, u'marginBottom': 70, u'marginLeft': 10, u'marginRight': 10, u'marginTop': 10, u'titleColor': u'#616161', u'titleFontSize': 17, u'titleFontWeight': u'normal', u'titleTextAlignment': u'left', u'widgetGap': 5, u'widgets': { u'Chord': { u'activeBackground': u'#f5f5f5', u'activeColor': u'#e55100', u'background': u'#ffffff', u'chartColorScheme': [ u'#4b8ecc', u'#348f5f', u'#ec6a2b', u'#807dba', u'#fec44f', u'#009994', u'#d43131', u'#0d7074' ], u'headerAlignment': u'left', u'headerBackground': u'#F5F5F5', u'headerColor': u'#b6b6b6', u'headerFontSize': 17, u'headerFontWeight': u'normal', u'linkBackground': u'#f5f5f5', u'linkColor': u'#2196F3', u'paddingBottom': 10, u'paddingLeft': 10, u'paddingRight': 10, u'paddingTop': 5, u'primaryButtonGradient1': u'#1484f9', u'primaryButtonGradient2': u'#156fcc', u'textColor': u'#212121' }, u'Connection': { u'color': u'#212121', u'fontAlign': u'center', u'fontSize': u'13', u'fontWeight': u'normal', u'hoverColor': u'#E3F2FD', u'labelColor': u'#212121', u'primaryButtonGradient1': u'#FFECB3', u'primaryButtonGradient2': u'#EF5350' }, u'Facets': {u'labelColor': u'#212121'}, u'FacetsHistogram': { u'labelColor': u'#212121', u'legendColor': u'#212121' }, u'FacetsList': { u'activeColor': u'#e55100', u'barColor': u'#1484f9', u'facetValueColor': u'#bdbdbd' }, u'FacetsTable': { u'activeBackground': u'#F5F5F5', u'activeColor': u'#e55100', u'headerColor': u'#616161' }, u'Frequency': {u'labelColor': u'#212121'}, u'HorizontalResultList': { u'linkColor': u'#2196F3', u'subtitleColor': u'#616161' }, u'IFrame': {}, u'Keywords': { u'barColor': u'#1484f9', u'headerColor': u'#616161', u'linkColor': u'#2196F3' }, u'PredQuery': { u'activeBackground': u'#F5F5F5', u'activeColor': u'#e55100' }, u'Search': { u'activeColor': u'#e55100', u'titleColor': u'#616161', u'titleColorRead': u'#212121', u'titleFontSize': 15, u'titleFontSizeRead': 15, u'titleFontWeight': u'bolder', u'titleFontWeightRead': u'bolder', u'titleTextAlignment': u'left', u'titleTextAlignmentRead': u'left' }, u'SearchQuery': { u'backgroundColor': u'#428bca', u'borderColor': u'#1e88e5', u'textColor': u'#ffffff' }, u'SignificantTerms': {}, u'TagCloud': {}, u'default': { u'activeBackground': u'#f5f5f5', u'activeColor': u'#e55100', u'background': u'#ffffff', u'chartColorScheme': [ u'#64b5f6', u'#E57373', u'#FFD54F', u'#81C784', u'#7986CB', u'#4DD0E1', u'#F06292', u'#AED581', u'#A1887F', u'#FFB74D', u'#4FC3F7', u'#FF8A65', u'#DCE775', u'#BA68C8' ], u'headerAlignment': u'left', u'headerBackground': u'#F5F5F5', u'headerColor': u'#616161', u'headerFontSize': 17, u'headerFontWeight': u'normal', u'linkBackground': u'#f5f5f5', u'linkColor': u'#2196F3', u'paddingBottom': 10, u'paddingLeft': 10, u'paddingRight': 10, u'paddingTop': 5, u'textColor': u'#212121' } } }, u'id': u'ofVfiQ-uRWSZeGFZspH9nQ', u'scope': u'default', u'title': u'Squirro Default'}, u'theme_id': u'ofVfiQ-uRWSZeGFZspH9nQ', u'title': u'foo', u'type': u'dashboard' }
modify_dashboard
modify_dashboard(project_id, dashboard_id, title=None, search=None, type=None, column_count=None, row_height=None, theme_id=None, hide_title=None, reset_placement=None, sections=None, sidepanel=None, loaders=None)
Update a dashboard.
Parameters: |
|
---|---|
Returns: | A dictionary of the updated dashboard. |
Example:
>>> client.modify_dashboard('2aEVClLRRA-vCCIvnuEAvQ', 'YagQNSecR_ONHxwBmOkkeQ', search={'query': 'Demo'})
move_dashboard
move_dashboard(project_id, dashboard_id, after)
Move a dashboard.
Parameters: |
|
---|---|
Returns: | No return value. |
Example:
>>> client.move_dashboard('2aEVClLRRA-vCCIvnuEAvQ', 'Ue1OceLkQlyz21wpPqml9Q', 'nJXpKUSERmSgQRjxX7LrZw')
delete_dashboard
delete_dashboard(project_id, dashboard_id)
Delete a specific dashboard from the given project.
Parameters: |
|
---|---|
Returns: | No return value. |
Example:
>>> client.delete_dashboard('2aEVClLRRA-vCCIvnuEAvQ', 'Ue1OceLkQlyz21wpPqml9Q')
get_dashboard_themes
get_dashboard_themes(project_id)
Return all dashboard themes for the given project.
Parameters: | project_id – Project identifier |
---|---|
Returns: | A list of dashboard theme dictionaries. |
Example:
>>> client.get_dashboard_themes('2aEVClLRRA-vCCIvnuEAvQ') [{u'id': u'G0Tm2SQcTqu2d4GvfyrsMg', u'title': u'Test', u'scope': u'custom', u'definition': [{u'background': u'#ffffff', u'titleColor': u'#525252', .....}]}]
get_dashboard_theme
get_dashboard_theme(project_id, theme_id)
Return a specific dashboard theme from the given project.
Parameters: |
|
---|---|
Returns: | A dictionary of the given dashboard theme. |
Example:
>>> client.get_dashboard_theme('2aEVClLRRA-vCCIvnuEAvQ', 'G0Tm2SQcTqu2d4GvfyrsMg') {u'id': u'G0Tm2SQcTqu2d4GvfyrsMg', u'title': u'Test', u'scope': u'custom', u'definition': [{u'background': u'#ffffff', u'titleColor': u'#525252', .....}]}]
new_dashboard_theme
new_dashboard_theme(project_id, title, definition=None)
Create a new dashboard theme.
Parameters: |
|
---|---|
Returns: | Location of new theme. |
Example:
>>> client.new_dashboard_theme('2aEVClLRRA-vCCIvnuEAvQ', title='Sample') {u'id': u'G0Tm2SQcTqu2d4GvfyrsMg', u'title': u'Test', u'scope': u'custom', u'definition': [{u'background': u'#ffffff', u'titleColor': u'#525252', .....}]}]
modify_dashboard_theme
modify_dashboard_theme(project_id, theme_id, title=None, definition=None)
Update a dashboard theme.
Parameters: |
|
---|---|
Returns: | A dictionary of the updated dashboard. |
Example:
>>> client.modify_dashboard_theme('2aEVClLRRA-vCCIvnuEAvQ', 'YagQNSecR_ONHxwBmOkkeQ', title='New Title') { u'id': u'YagQNSecR_ONHxwBmOkkeQ', u'title': u'New Title', u'definition': [{u'background': u'#ffffff', u'titleColor': u'#525252', .....}]}] }
delete_dashboard_theme
delete_dashboard_theme(project_id, theme_id)
Delete a specific dashboard theme from the given project.
Parameters: |
|
---|---|
Returns: | No return value. |
Example:
>>> client.delete_dashboard_theme('2aEVClLRRA-vCCIvnuEAvQ', 'Ue1OceLkQlyz21wpPqml9Q')
get_dashboard_widgets
get_dashboard_widgets()
Return all dashboard widgets (for tenant).
Returns: | A list of custom dashboard widgets dictionaries. |
---|
Example:
>>> client.get_dashboard_widgets() [{u'id': u'G0Tm2SQcTqu2d4GvfyrsMg', u'title': u'Test', u'scope': u'custom', u'definition': [{u'background': u'#ffffff', u'titleColor': u'#525252', .....}]}]
get_dashboard_widget
get_dashboard_widget(name)
Return a specific custom dashboard widget.
Parameters: | name – Name of custom widget (in current tenant) |
---|---|
Returns: | A dictionary of the named custom widget. |
Example:
>>> client.get_dashboard_widget('map_us') {u'id': u'G0Tm2SQcTqu2d4GvfyrsMg', u'title': u'Test', u'scope': u'custom', u'definition': [{u'background': u'#ffffff', u'titleColor': u'#525252', .....}]}]
new_dashboard_widget
new_dashboard_widget(config)
Upload a new custom widget to squirro :param config: properties that require at least the directory
title property for use in the user interface is optional. All properties other than directory are passed on to the backend in the widget.ini file unless widget.ini already exists. The name and hash properties are reserved for internal use.
Example:
>>> client.new_dashboard_widget( >>> config={u'directory': u'/home/us_map', >>> u'base_widget': u'world_map', >>> u'friendly_name': u'Map of the USA'})
get_assets
get_assets(asset_type)
Return all assets of asset_type for tenant.
Returns: | A list of custom assets dictionaries. |
---|
Example:
>>> client.get_assets('dashboard_loader') [{u'id': u'G0Tm2SQcTqu2d4GvfyrsMg', u'title': u'Layers and Sections Dashboard Loader', u'scope': u'custom', u'definition': [{u'background': u'#ffffff', u'titleColor': u'#525252', .....}]}]
get_asset
get_asset(asset_type, name)
Return a specific custom asset.
Parameters: |
|
---|---|
Returns: | A dictionary of the named asset. |
Example:
>>> client.get_asset('dashboard_loader', 'layer_loader') {u'id': u'G0Tm2SQcTqu2d4GvfyrsMg', u'title': u'Layer Dashboard Loader', u'scope': u'custom', u'definition': [{u'background': u'#ffffff', u'titleColor': u'#525252', .....}]}]
new_asset
new_asset(asset_type, folder)
Upload a new custom asset to squirro :param asset_type: Type of asset (e.g. ‘dashboard_loader’) :param folder: name of a directory to be packaged into
folder/asset_type.json . The name and hash properties are reserved for internal use.
Example:
>>> client.new_asset( >>> asset_type='dashboard_loader', >>> folder='./my_dashboard_loader')
get_pipelets
get_pipelets()
Return all available pipelets.
These pipelets can be used for enrichments of type pipelet.
Returns: | A dictionary where the value for pipelets is a list of pipelets. |
---|
Example:
>>> client.get_pipelets() {u'pipelets': [{u'id': u'tenant01/textrazor', u'name': u'textrazor'}]}
create_enrichment
create_enrichment(project_id, type, name, config, before=None)
Create a new enrichment on the project.
Parameters: |
|
---|---|
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' }
get_enrichments
get_enrichments(project_id)
Return enrichments configured on this project.
Parameters: | project_id – Project identifier. Enrichments are retrieved from this project. |
---|
Example:
>>> client.get_enrichments('Sz7LLLbyTzy_SddblwIxaA') [{ 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_enrichment
get_enrichment(project_id, enrichment_id)
Returns a single enrichment configured on this project.
Parameters: |
|
---|
Example:
>>> client.get_enrichment('Sz7LLLbyTzy_SddblwIxaA', 'pipelet-rTBoGNl6S4aG4TDkBoN6xQ'}) { 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
delete_enrichment(project_id, enrichment_id)
Delete a single enrichment configured on this project.
Parameters: |
|
---|
Example:
>>> client.delete_enrichment('Sz7LLLbyTzy_SddblwIxaA', 'pipelet-rTBoGNl6S4aG4TDkBoN6xQ')
update_enrichment
update_enrichment(project_id, enrichment_id, type, name, config)
Update a single enrichment configured on this project.
Parameters: |
|
---|---|
Returns: | The modified enrichment. |
Example:
>>> client.update_enrichment('Sz7LLLbyTzy_SddblwIxaA', 'pipelet-rTBoGNl6S4aG4TDkBoN6xQ', 'pipelet', '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' }
get_facet
get_facet(project_id, id)
Retrieves a facet of project project_id.
Parameters: |
|
---|
get_facets
get_facets(project_id)
Retrieves all facets of project project_id.
Parameters: | project_id – Project identifier |
---|
new_facet
new_facet(project_id, name, data_type=None, display_name=None, group_name=None, visible=None, format_instr=None, searchable=None, typeahead=None, analyzed=None)
Creates a new facet on project project_id.
Parameters: |
|
---|
modify_facet
modify_facet(project_id, id, display_name=None, group_name=None, visible=None, format_instr=None, searchable=None, typeahead=None, **kwargs)
Modifies a facet on project project_id.
Parameters: |
|
---|
get_facet_stats
get_facet_stats(project_id, id)
Returns stats for a facet on project project_id.
Parameters: |
|
---|
Example::
>>> client.get_facet_stats('Sz7LLLbyTzy_SddblwIxaA', 'da1d234f7e85c4edf37c3286ad7d4ea2c0c64ee8899a5219be21077214719d77'}) { u'all_single_values': True }