Mixin classes which encapsulate the functionality of the object API service. See Working with Entities for documentation on the API.
All the methods of these classes are made available in the SquirroClient class.
Table of Contents
class squirro_client.topic.TopicApiBaseMixin
get_projects
get_projects()
Return all projects.
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'}]}
get_pipelet
get_pipelet(name)
Return details for one pipelet.
returns: A dictionary with pipelet details. Example:
>>> client.get_pipelet('textrazor') {u'description': u'Entity extraction with `TextRazor`.', u'description_html': u'<p>Entity extraction with <code>TextRazor</code>.</p>', u'id': u'tenant01/textrazor', u'name': u'textrazor', u'source': u'from squirro.sdk.pipelet import PipeletV1
...’}
delete_pipelet
delete_pipelet(name)
Delete a pipelet.
This will break existing enrichments if they still make use of this pipelet.
Example:
>>> client.delete_pipelet('textrazor')
get_version
get_version()
Get current squirro version and build number.
Returns: | Dictionary contains ‘version’, ‘build’ and ‘components’. ‘components’ is used for numeric comparison. |
---|
Example:
>>> client.get_version() { "version": "2.4.5", "build": "2874" "components": [2, 4, 5] }
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, child_count=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: |
|
---|
recommend
recommend(project_id, item_id=None, external_id=None, text=None, method=None, related_fields=None, count=10, fields=None, created_before=None, options=None, created_after=None, query=None, aggregations=None, method_params=None, **kwargs)
Returns recommended items for the provided ids or text.
Parameters: |
|
---|
recommendation_methods
recommendation_methods(project_id)
Returns the available recommendation methods.
Parameters: | project_id – Project identifier. |
---|
recommend_facets
recommend_facets(project_id, method=None, count=10, data=None)
Recommend facet value based on input facets
Parameters: |
|
---|---|
Returns: | Recommendation response |
Example:
data = { "input_features": { "Job": ["Head of Sales", "Head of Marketing"], "City": ["Zurich", "London"], "Salary": [{ "gte": 80000, "lte": 120000 }] }, "filter_query": "$item_created_at>=2018-03-20T00:00:00", "target_feature": "Person_Id", "return_features": ["Name"], "ml_workflow_id": None } >>> client.recommend_facets( ... project_id='2aEVClLRRA-vCCIvnuEAvQ', ... method='conprob', data=data, count=3) response = { "count": 3, "time_ms": 79, "params": {...}, "total": 989, "method": { "last_updated": null, "name": "conprob", "ml_workflow_id": null }, "recommendations": [{ "target_feature": "Person_Id", "score": 1.0, "explanation": { "query": "City:"Zurich" AND Job:"Head of Sales" AND (Salary>=80000 AND Salary<=100000) AND $item_created_at>="2018-03-20T00:00:00" AND Name:"Amber Duncan"", "doc_count": 1, "features": [ { "score": 0.7713846764962218, "feature": "City", "value": "Zurich" }, { "score": 0.7461064995415513, "feature": "Job", "value": "Head of Sales" }, { "score": 0.7289157048296231, "feature": "Salary", "value": { "gte": 80000, "lte": 100000 } } ], "num_matching_features": 3, "num_hits": 1 }, "return_features": { "Name": "Amber Duncan" }, "target_value": "1234"}, ... ] }
recommend_facets_explore
recommend_facets_explore(project_id, method=None, count=10, data=None)
Explore results of facet recommendation
Parameters: |
|
---|---|
Returns: | List of items with facets satisfied input |
Example:
data = { "input_features": { "Job": ["Head of Sales", "Head of Marketing"], "City": ["Zurich", "London"], "Salary": [{ "gte": 80000, "lte": 120000 }] }, "filter_query": "$item_created_at>=2018-03-20T00:00:00", "target_feature": "Person_Id", "target_value": "Squirro", "filter_features": { "Job": ["Head of Sales"] }, "ml_workflow_id": None } >>> client.recommend_facets_explore( ... project_id='2aEVClLRRA-vCCIvnuEAvQ', ... method='conprob', data=data, count=10)
recommend_facets_methods
recommend_facets_methods(project_id)
Returns the available facet recommendation methods.
Parameters: | project_id – Project identifier. |
---|
recommend_entities
recommend_entities(project_id, method=None, count=10, data=None)
Recommend entity property based on input entity properties
Parameters: |
|
---|---|
Returns: | Recommendation response |
Example:
data = { "input_features": { "job": ["Head of Sales", "Head of Marketing"], "city": ["Zurich", "London"], "salary": [{ "gte": 80000, "lte": 120000 }] }, "filter_query": "$item_created_at>=2018-03-20T00:00:00", "target_feature": "person_id", "return_features": ["name"], "ml_workflow_id": None, "entity_type": "career" } >>> client.recommend_entities( ... project_id='2aEVClLRRA-vCCIvnuEAvQ', ... method='conprob', data=data, count=3) response = { "count": 3, "time_ms": 79, "params": {...}, "total": 989, "method": { "last_updated": null, "name": "conprob", "ml_workflow_id": null }, "recommendations": [{ "target_feature": "person_id", "score": 1.0, "explanation": { "query": "entity:{city:"Zurich" AND job:"Head of sales" AND (salary>=80000 AND salary<=100000)} AND $item_created_at>="2018-03-20T00:00:00" AND entity:{name:"Amber Duncan"}", "doc_count": 1, "features": [ { "score": 0.7713846764962218, "feature": "city", "value": "Zurich" }, { "score": 0.7461064995415513, "feature": "job", "value": "Head of Sales" }, { "score": 0.7289157048296231, "feature": "salary", "value": { "gte": 80000, "lte": 100000 } } ], "num_matching_features": 3, "num_hits": 1 }, "return_features": { "name": "Amber Duncan" }, "target_value": "person_1234"}, ... ] }
recommend_entities_explore
recommend_entities_explore(project_id, method=None, count=10, data=None)
Explore results of entity recommendation
Parameters: |
|
---|---|
Returns: | List of items and entities satisfied input |
Example:
data = { "input_features": { "job": ["Head of Sales", "Head of Marketing"], "city": ["Zurich", "London"], "salary": [{ "gte": 80000, "lte": 120000 }] }, "filter_query": "$item_created_at>=2018-03-20T00:00:00", "target_feature": "person_id", "target_value": "a_squirro_employee", "filter_features": { "job": ["Head of Sales"] }, "ml_workflow_id": None, "entity_type": "career" } >>> client.recommend_entities_explore( ... project_id='2aEVClLRRA-vCCIvnuEAvQ', ... method='conprob', data=data, count=10)
recommend_entities_methods
recommend_entities_methods(project_id)
Returns the available entity recommendation methods.
Parameters: | project_id – Project identifier. |
---|
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, child_count=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.
DEPRECATED. The query method is more powerful.
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/...', 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...', 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 "mmonic"' }], u'starred': False, u'thumbler_url': u'[long url]...jpg', u'title': u'Web Clipping - made easy with Memonic', u'objects': [], u'webshot_height': 360, u'webshot_url': u'http://webshot.trunk....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', 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/...', 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'[long url]...jpg', u'title': u'Web Clipping - made easy with Memonic', u'objects': [], u'webshot_height': 360, u'webshot_url': u'http://webshot.trunk....jpg', u'webshot_width': 480}}
modify_item
modify_item(project_id, item_id, star=None, read=None, keywords=None, entities=None)
Updates the flags, entities, and/or keywords of an item.
You can only update star, read, and keywords. The new values will overwrite all old values.
Parameters: |
|
---|
Example:
>>> client.modify_item( ... '2aEVClLRRA-vCCIvnuEAvQ', 'haG6fhr9RLCm7ZKz1Meouw', ... star=True, ... read=False, ... entities=[], ... keywords={'Canton': ['Zurich'], 'Topic': None, ... 'sports': [{'hockey', 0.9}, {'baseball', 0.1}]
modify_items
modify_items(project_id, items, batch_size=10000)
Updates the flags and/or keywords of a list of items.
You can only update star, read, and keywords. The new values will overwrite all old values.
Parameters: |
|
---|
Example:
>>> client.modify_items( ... '2aEVClLRRA-vCCIvnuEAvQ', [ ... { ... 'id': 'haG6fhr9RLCm7ZKz1Meouw', ... 'star': True, ... 'read': False, ... 'keywords': {'Canton': ['Berne'], 'Topic': None, ... 'sports': [{'hockey': 0.3}, ... {'baseball': 0.5}] ... }, ... { ... 'id': 'masnnawefna9MMf3lk', ... 'star': False, ... 'read': True, ... 'keywords': {'Canton': ['Zurich'], 'Topic': None, ... 'sports': [{'hockey': 0.9}, ... {'baseball': 0.1}] ... }], ... batch_size=1000 ... )
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, filter_query=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_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/', u'read': False, u'item_score': 0, u'score': 0, u'starred': False, u'thumbler_url': u'[long url ...]/...jpg', u'title': u'Swisscom features our sister product', u'webshot_height': 237, u'webshot_url': u'http://webshot.trunk...', 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/', u'read': False, u'item_score': 0, u'score': 0, u'starred': False, u'thumbler_url': u'[long url ...]/...jpg', u'title': u'247 million emails are sent every day...', u'webshot_height': 360, u'webshot_url': u'http://webshot.trunk...', u'webshot_width': 480}]}
assert_permission
assert_permission(project_id=None, user_permissions=None, project_permissions=None)
Ensure the user has the right permissions on the project.
Parameters: |
|
---|---|
Returns: | True if the permissions are met. |
Example:
>>> client.assert_permissions('2aEVClLRRA-vCCIvnuEAvQ', user_permissions='admin')
Or with multiple permissions (at least one permission needs to match):
>>> client.assert_permissions('2aEVClLRRA-vCCIvnuEAvQ', project_permissions=['items.read', 'project.read'])
class squirro_client.topic.ContributingRecordsMixin
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_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') {}
class squirro_client.topic.DashboardsMixin
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, widgets=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')
class squirro_client.topic.EnrichmentsMixin
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, type=None)
Return enrichments configured on this project.
Parameters: |
|
---|
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' }]
get_enrichment
get_enrichment(project_id, enrichment_id, type=None)
Returns a single enrichment configured on this project.
Parameters: |
|
---|
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' }
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' }
class squirro_client.topic.FacetsMixin
get_facet
get_facet(project_id, facet_id_or_name)
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, synonyms_id=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, synonyms_id=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 }
class squirro_client.topic.MachineLearningMixin
new_machinelearning_workflow
new_machinelearning_workflow(project_id, ml_workflow_config, ml_models=None)
Create a new Machine Learning Workflow.
Parameters: |
|
---|
get_machinelearning_workflows
get_machinelearning_workflows(project_id)
Return all Machine Learning workflows for a project.
Parameters: | project_id – Id of the Squirro project. |
---|
get_machinelearning_workflow
get_machinelearning_workflow(project_id, ml_workflow_id)
Return a specific Machine Learning Workflow in a project.
Parameters: |
|
---|
modify_machinelearning_workflow
modify_machinelearning_workflow(project_id, ml_workflow_id, ml_workflow_config, ml_models=None)
Modify an existing Machine Learning workflow.
Parameters: |
|
---|
delete_machinelearning_workflow
delete_machinelearning_workflow(project_id, ml_workflow_id)
Delete a Machine Learning workflow.
Parameters: |
|
---|
new_machinelearning_job
new_machinelearning_job(project_id, ml_workflow_id, type)
Create a new Machine Learning job.
Parameters: |
|
---|
get_machinelearning_jobs
get_machinelearning_jobs(project_id, ml_workflow_id)
Return all the Machine Learning jobs for a particular Machine Learning workflow.
Parameters: |
|
---|
get_machinelearning_job
get_machinelearning_job(project_id, ml_workflow_id, ml_job_id)
Return a particular Machine Learning job.
Parameters: |
|
---|
delete_machinelearning_job
delete_machinelearning_job(project_id, ml_workflow_id, ml_job_id)
Delete a Machine Learning job.
Parameters: |
|
---|
class squirro_client.topic.ObjectsMixin
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'A', 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)
Modify an object.
Parameters: |
|
---|
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_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'}
class squirro_client.topic.PipelineStatusMixin
get_pipeline_status
get_pipeline_status(sections=[])
Returns all or the specified status sections of the ingester status.
Parameters: | sections – optional, list of sections to return. |
---|---|
Returns: | A status dictionary. |
perform_pipeline_action
perform_pipeline_action(action, action_config=None)
Performs an ingester action.
Parameters: |
|
---|---|
Returns: | A status dictionary. |
Currently, only the action “reset” is supported. It does not take any action_config and will delete the full ingester backlog.
class squirro_client.topic.PipelineWorkflowMixin
get_pipeline_workflows
get_pipeline_workflows(project_id, omit_steps=False)
Return all pipeline workflows for project with project_id.
Parameters: |
|
---|---|
Returns: | A list of pipeline workflow dictionaries. |
Example:
>>> client.get_pipeline_workflows('project_id_1') [{'id': 'pipeline_workflow_id_1', 'project_id': 'project_id_1', 'name': 'Pipeline Workflow 1', 'project_default': True, 'steps': [ {"name": "Pipelet", "type": "pipelet", "display_name": "PermID OpenCalais", "id": "XPOxEgNSR3W4TirOwOA-ng", "config": {"config": {"api_key": "AGa865", "confidence": 0.7}, "pipelet": "searches/PermID Entities Enrichment"}, }, {"name": "Index", "type": "index", ... } ] }, {'id': 'pipeline_workflow_id_2', ... }, ... ]
get_pipeline_workflow
get_pipeline_workflow(project_id, workflow_id, omit_steps=False)
Return a specific pipeline workflow workflow_id in project with project_id.
Parameters: |
|
---|---|
Returns: | A dictionary of the pipeline workflow. |
Example:
>>> client.get_pipeline_workflow('project_id_1', 'workflow_id_1') {'id': 'pipeline_workflow_id_1', 'project_id': 'project_id_1', 'name': 'Pipeline Workflow 1', 'steps': [ {"name": "Pipelet", "type": "pipelet", "display_name": "PermID OpenCalais", "id": "XPOxEgNSR3W4TirOwOA-ng", "config": {"config": {"api_key": "AGa8A65", "confidence": 0.7}, "pipelet": "searches/PermID Entities Enrichment"}, }, {"name": "Index", "type": "index", ... } ] }
new_pipeline_workflow
new_pipeline_workflow(project_id, name, steps=None)
Creates a new pipeline workflow
Parameters: |
|
---|
Example:
>>> client.new_pipeline_workflow( >>> name='Pipeline Workflow 1', >>> steps=[{"name": "Index", >>> "type": "index"}])
modify_pipeline_workflow
modify_pipeline_workflow(project_id, workflow_id, name=None, steps=None, project_default=None)
Updates a pipeline workflow
Parameters: |
|
---|
Example:
>>> client.set_pipeline_workflow( >>> name='Pipeline Workflow 1', >>> steps=[{"name": "Index", >>> "type": "index"}])
delete_pipeline_workflow
delete_pipeline_workflow(project_id, workflow_id)
Deletes a pipeline workflow as long as it is no longer needed. Project default workflows cannot be deleted and neither can workflows that still have subscriptions referring to them.
Parameters: |
|
---|---|
Returns: | 204 if deletion has been successful |
Example:
>>> client.delete_pipeline_workflow( >>> project_id='project_id_1', >>> workflow_id='pipeline_workflow_id_1',
move_pipeline_workflow_step
move_pipeline_workflow_step(project_id, workflow_id, step_id, after)
Move a pipelet step within a workflow.
Parameters: |
|
---|---|
Returns: | updated workflow |
Example:
>>> client.move_pipeline_workflow_step('2aEVClLRRA-vCCIvnuEAvQ', ... 'Ue1OceLkQlyz21wpPqml9Q', ... 'nJXpKUSERmSgQRjxX7LrZw', ... 'language-detection')
class squirro_client.topic.ProjectsMixin
get_user_projects
get_user_projects()
Get projects for the provided user.
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)
class squirro_client.topic.SavedSearchesMixin
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')
class squirro_client.topic.SmartfiltersMixin
get_project_smartfilters
get_project_smartfilters(project_id, tags=None, include_config=False)
Get all smartfilters which are applicable on a object.
Parameters: |
|
---|---|
Returns: | A list of smartfilters. |
Example:
>>> client.get_project_smartfilters('zgxIdCxSRWSwJzL1fwNX1Q') []
get_smartfilter
get_smartfilter(type, type_id, name)
Get a single smartfilter for the provided parameters.
Parameters: |
|
---|---|
Returns: | Fingerprint information in a dictionary. |
Example:
>>> client.get_smartfilter('object', 'zgxIdCxSRWSwJzL1fwNX1Q', ... 'default') {}
get_project_smartfilter_scores
get_project_smartfilter_scores(project_id, tags, object_id=None, fields=None)
Get the smartfilter scores for all items contained in the specified project. One ore more smartfilters are selected by specifying tags.
Parameters: |
|
---|---|
Returns: | A list of smartfilter score entries. |
Example:
>>> client.get_project_smartfilter_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_smartfilter_attributes
validate_smartfilter_attributes(data)
Validates the attributes syntax of a smartfilter.
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_smartfilter_attributes(data) {}
Invalid example:
>>> data = {'config': { 'manual_features': 'invalid, 1.5, de, Term1'}} >>> try: >>> client.validate_smartfilter_attributes(data) >>> except squirro_client.exceptions.ClientError as e: >>> print e.error u'[{"line": 0, "error": "required default language is missing"}]'
new_smartfilter
new_smartfilter(type, type_id, name=None, data=None)
Create a new smartfilter for the provided parameters.
Parameters: |
|
---|
Example:
>>> data = {'title': 'Earnings Call'} >>> client.new_smartfilter( ... 'user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data) {}
copy_smartfilter
copy_smartfilter(type, type_id, name)
Copies the smartfilter for the provided parameters.
Parameters: |
|
---|
Example:
>>> client.copy_smartfilter('tenant', 'squirro', 'ma') {}
update_smartfilter_from_content
update_smartfilter_from_content(type, type_id, name, content)
Updates the smartfilter for the provided parameters from content data.
Parameters: |
|
---|
Example:
>>> data = [{'lang': 'en', 'text': 'english content'}] >>> client.update_smartfilter_from_content( ... 'user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data) {}
update_smartfilter_from_items
update_smartfilter_from_items(type, type_id, name, items, negative=False)
Updates the smartfilter for the provided parameters from items data.
Parameters: |
|
---|
Example:
>>> data = ['tfoOHGEZRAqFURaEE2cPWA'] >>> client.update_smartfilter_from_items( ... 'user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data) {}
update_smartfilter_attributes
update_smartfilter_attributes(type, type_id, name, data)
Updates the smartfilter key-value attributes for the provided parameters.
Parameters: |
|
---|
Example:
>>> data = {'title': 'Earnings Call'} >>> client.update_smartfilter_attributes( ... 'user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data)
delete_smartfilter
delete_smartfilter(type, type_id, name)
Deletes the smartfilter for the provided parameters.
Parameters: |
|
---|
Example:
>>> client.delete_smartfilter('user', 'bgFtu5rkR1STpx1xR2u1UQ', ... 'default')
move_smartfilter
move_smartfilter(type, type_id, name, target_name)
Moves the smartfilter for the provided parameters.
This saves the smartfilter and removes the temporary flag. The old smartfilter is not removed.
Parameters: |
|
---|
Example:
>>> client.move_smartfilter('user', 'bgFtu5rkR1STpx1xR2u1UQ', ... 'default')
protect_smartfilter
protect_smartfilter(type, type_id, name, locked)
Sets the locked state of a smartfilter.
Parameters: |
|
---|
Example:
>>> client.protect_smartfilter( ... 'user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', True)
get_smartfilter_matches_for_query
get_smartfilter_matches_for_query(type, type_id, name, language, noise_level=0.1, **kwargs)
Returns the match counts for each feature of smartfilter 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. |
copy_fingerprint
copy_fingerprint(type, type_id, name)
Copies the smartfilter for the provided parameters.
Parameters: |
|
---|
Example:
>>> client.copy_smartfilter('tenant', 'squirro', 'ma') {}
delete_fingerprint
delete_fingerprint(type, type_id, name)
Deletes the smartfilter for the provided parameters.
Parameters: |
|
---|
Example:
>>> client.delete_smartfilter('user', 'bgFtu5rkR1STpx1xR2u1UQ', ... 'default')
get_fingerprint
get_fingerprint(type, type_id, name)
Get a single smartfilter for the provided parameters.
Parameters: |
|
---|---|
Returns: | Fingerprint information in a dictionary. |
Example:
>>> client.get_smartfilter('object', 'zgxIdCxSRWSwJzL1fwNX1Q', ... 'default') {}
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 smartfilter 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. |
get_project_fingerprint_scores
get_project_fingerprint_scores(project_id, tags, object_id=None, fields=None)
Get the smartfilter scores for all items contained in the specified project. One ore more smartfilters are selected by specifying tags.
Parameters: |
|
---|---|
Returns: | A list of smartfilter score entries. |
Example:
>>> client.get_project_smartfilter_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}]}]
get_project_fingerprints
get_project_fingerprints(project_id, tags=None, include_config=False)
Get all smartfilters which are applicable on a object.
Parameters: |
|
---|---|
Returns: | A list of smartfilters. |
Example:
>>> client.get_project_smartfilters('zgxIdCxSRWSwJzL1fwNX1Q') []
move_fingerprint
move_fingerprint(type, type_id, name, target_name)
Moves the smartfilter for the provided parameters.
This saves the smartfilter and removes the temporary flag. The old smartfilter is not removed.
Parameters: |
|
---|
Example:
>>> client.move_smartfilter('user', 'bgFtu5rkR1STpx1xR2u1UQ', ... 'default')
new_fingerprint
new_fingerprint(type, type_id, name=None, data=None)
Create a new smartfilter for the provided parameters.
Parameters: |
|
---|
Example:
>>> data = {'title': 'Earnings Call'} >>> client.new_smartfilter( ... 'user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data) {}
protect_fingerprint
protect_fingerprint(type, type_id, name, locked)
Sets the locked state of a smartfilter.
Parameters: |
|
---|
Example:
>>> client.protect_smartfilter( ... 'user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', True)
update_fingerprint_attributes
update_fingerprint_attributes(type, type_id, name, data)
Updates the smartfilter key-value attributes for the provided parameters.
Parameters: |
|
---|
Example:
>>> data = {'title': 'Earnings Call'} >>> client.update_smartfilter_attributes( ... 'user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data)
update_fingerprint_from_content
update_fingerprint_from_content(type, type_id, name, content)
Updates the smartfilter for the provided parameters from content data.
Parameters: |
|
---|
Example:
>>> data = [{'lang': 'en', 'text': 'english content'}] >>> client.update_smartfilter_from_content( ... 'user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data) {}
update_fingerprint_from_items
update_fingerprint_from_items(type, type_id, name, items, negative=False)
Updates the smartfilter for the provided parameters from items data.
Parameters: |
|
---|
Example:
>>> data = ['tfoOHGEZRAqFURaEE2cPWA'] >>> client.update_smartfilter_from_items( ... 'user', 'bgFtu5rkR1STpx1xR2u1UQ', 'default', data) {}
validate_fingerprint_attributes
validate_fingerprint_attributes(data)
Validates the attributes syntax of a smartfilter.
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_smartfilter_attributes(data) {}
Invalid example:
>>> data = {'config': { 'manual_features': 'invalid, 1.5, de, Term1'}} >>> try: >>> client.validate_smartfilter_attributes(data) >>> except squirro_client.exceptions.ClientError as e: >>> print e.error u'[{"line": 0, "error": "required default language is missing"}]'
class squirro_client.topic.SubscriptionsMixin
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', u'workflow': { u'name': u'Default Workflow', u'project_default': True, u'id': u'kAvdogQOQvGHijqcIPi_WA', u'project_id': u'FzbcEMMNTBeQcG2wnwnxLQ' } } ]
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, u'workflow': { u'name': u'Default Workflow', u'project_default': True, u'id': u'kAvdogQOQvGHijqcIPi_WA', u'project_id': u'FzbcEMMNTBeQcG2wnwnxLQ' } }
new_subscription
new_subscription(project_id, object_id, provider, config, user_id=None, seeder=None, private=None, workflow_id=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, u'workflow': { u'name': u'Default Workflow', u'project_default': True, u'id': u'kAvdogQOQvGHijqcIPi_WA', u'project_id': u'FzbcEMMNTBeQcG2wnwnxLQ'} }
modify_subscription
modify_subscription(project_id, object_id, subscription_id, workflow_id=None, config=None)
Modify an existing subscription.
Parameters: |
|
---|---|
Returns: | A dictionary which contains the subscription. |
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')
class squirro_client.topic.SynonymsMixin
new_synonym_list
new_synonym_list(project_id, title, synonyms)
Creates a new synonym list
Parameters: |
|
---|
Example:
>>> client.new_synonym_list('Sz7LLLbyTzy_SddblwIxaA', 'general english synonyms', ['humorous,comical,hilarious,hysterical', 'attractive,pretty,lovely,stunning']) {u'project_id': u'Sz7LLLbyTzy_SddblwIxaA', u'synonyms_id': u'H2DKVGU8Sv-GpMlQ7PDnqw', u'title': u'general english synonyms', u'location': u'/v0/squirro/projects/Sz7LLLbyTzy_SddblwIxaA /synonyms/H2DKVGU8Sv-GpMlQ7PDnqw'}
modify_synonym_list
modify_synonym_list(project_id, synonyms_id, title=None, synonyms=None)
Modifies an existing synonym list
Parameters: |
|
---|
Example:
>>> client.modify_synonym_list('Sz7LLLbyTzy_SddblwIxaA', 'H2DKVGU8Sv-GpMlQ7PDnqw', 'english names', ['humorous,comical,hilarious,hysterical', 'attractive,pretty,lovely,stunning'])
get_synonym_id_list
get_synonym_id_list(project_id)
Returns all synonym id list for one project.
Parameters: | project_id – Project Identifier |
---|
Example:
>>> client.get_synonym_id_list('Sz7LLLbyTzy_SddblwIxaA') [u'H2DKVGU8Sv-GpMlQ7PDnqw', u'SKAcjj_QORSRRYVMbBR9ig']
get_synonym_list
get_synonym_list(project_id, synonyms_id)
Returns a synonym list.
Parameters: |
|
---|
Example:
>>> client.get_synonym_list('Sz7LLLbyTzy_SddblwIxaA', 'H2DKVGU8Sv-GpMlQ7PDnqw') {u'project_id': u'Sz7LLLbyTzy_SddblwIxaA', u'synonyms_id': u'H2DKVGU8Sv-GpMlQ7PDnqw', u'title': u'english names', u'synonyms': [ u'humorous,comical,hilarious,hysterical', u'attractive,pretty,lovely,stunning' ]}
delete_synonym_list
delete_synonym_list(project_id, synonyms_id)
Deletes a synonym list
Parameters: |
|
---|
Example:
>>> client.delete_synonym_list('Sz7LLLbyTzy_SddblwIxaA', 'H2DKVGU8Sv-GpMlQ7PDnqw') {}
class squirro_client.topic.TasksMixin
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. |
---|
class squirro_client.topic.ThemesMixin
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')
class squirro_client.topic.TrendDetectionMixin
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' ) { 'trend_detection_entity': { u'id': u'iR81vxDnShu5di4snCu6Jg', u'created_at': u'2016-02-23T16:28:00', 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', u'email_user': u'test@squirro.com', u'last_alert_timestamp': None, u'last_seen_timestamp': None, u'trends_healthy': None } }
modify_trenddetection
modify_trenddetection(project_id, trenddetection_id, **kwargs)
Modifies a Trend detection Entity.
Parameters: |
|
---|
Example:
>>> client.modify_trenddetection( project_id='2sic33jZTi-ifflvQAVcfw', tde_id='F3k1dEJEQzmLRaIlN71AsA', name='test_name', email_user='test@squirro.com')
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) { 'trend_detection_entity': { u'created_at': u'2016-02-09T08:34:17', u'id': u'nwBnJ5tkQVGMjKFUBZ1Cbw', u'modified_at': u'2016-02-09T08:34:19', u'trends_healthy': True, 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)
DEPRECATED. Please use the get_trenddetection method instead.
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 } ] }
class squirro_client.topic.WidgetsAndAssetsMixin
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
Parameters: | config – properties that require at least the directory to be specified where the custom widget code resides. The 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, global_assets=False)
Return all assets of asset_type for tenant.
Parameters: | global_assets – Return all global assets if True. |
---|---|
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, global_asset=False)
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', .....}]}]
delete_asset
delete_asset(asset_type, name)
Delete a specific custom asset.
Parameters: |
|
---|
Example:
>>> client.delete_asset('dashboard_loader', 'layer_loader')
new_asset
new_asset(asset_type, folder, global_asset=False)
Upload a new custom asset to squirro.
Parameters: |
|
---|
Example:
>>> client.new_asset( >>> asset_type='dashboard_loader', >>> folder='./my_dashboard_loader')