WidgetsAndAssetsMixin#

class WidgetsAndAssetsMixin#

Bases: object

Methods Summary

delete_asset(asset_type, name[, global_asset])

Delete a specific custom asset.

delete_dashboard_widget(name)

Delete a specific custom dashboard widget.

get_asset(asset_type, name[, global_asset, ...])

Return a specific custom asset.

get_assets(asset_type[, global_assets])

Return all assets of asset_type for tenant.

get_dashboard_widget(name[, include_files])

Return a specific custom dashboard widget.

get_dashboard_widgets()

Return all dashboard widgets (for tenant).

new_asset(asset_type, folder[, global_asset])

Upload a custom asset to squirro.

new_dashboard_widget(config)

Upload a new custom widget to squirro

Methods Documentation

delete_asset(asset_type, name, global_asset=False)#

Delete a specific custom asset.

Parameters
  • asset_type – Type of asset (e.g. ‘dashboard_loader’)

  • name – Name of asset (in current tenant)

  • global_asset – Enables deletion of a global asset if True

Example:

>>> client.delete_asset('dashboard_loader', 'layer_loader')
delete_dashboard_widget(name)#

Delete a specific custom dashboard widget.

Parameters

name – Name of widget (in current tenant)

Example:

>>> client.delete_dashboard_widget('custom_widget')
get_asset(asset_type, name, global_asset=False, include_files=False)#

Return a specific custom asset.

Parameters
  • asset_type – Type of asset (e.g. ‘dashboard_loader’)

  • name – Name of asset (in current tenant)

  • global_asset – Return a global asset if True.

  • include_files – Bool, Returns all files with content of the asset if True. Default: False

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',
                 .....}]}]
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_dashboard_widget(name, include_files=False)#

Return a specific custom dashboard widget.

Parameters
  • name – Name of custom widget (in current tenant)

  • include_files – Bool, Returns all files with content of the asset if True. Default: False

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',
                 .....}]}]
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',
                   .....}]}]
new_asset(asset_type, folder, global_asset=False)#

Upload a custom asset to squirro.

Parameters
  • asset_type – Type of asset (e.g. ‘dashboard_loader’)

  • folder – name of a directory to be packaged into a tar.gz format and passed to the Squirro server. Configuration can be passed inside a file named folder/asset_type.json. The name and hash properties are reserved for internal use.

  • global_asset – Upload a global asset if True.

Example:

>>> client.new_asset(
>>>     asset_type='dashboard_loader',
>>>     folder='./my_dashboard_loader')
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'})