mstrio.distribution_services.subscription package

Submodules

mstrio.distribution_services.subscription.base_subscription module

class mstrio.distribution_services.subscription.base_subscription.RecipientsTypes(value)

Bases: mstrio.utils.enum_helper.AutoUpperName

An enumeration.

CONTACT = 'CONTACT'
CONTACT_GROUP = 'CONTACT_GROUP'
PERSONAL_ADDRESS = 'PERSONAL_ADDRESS'
UNSUPPORTED = 'UNSUPPORTED'
USER = 'USER'
USER_GROUP = 'USER_GROUP'
class mstrio.distribution_services.subscription.base_subscription.Subscription(connection: mstrio.connection.Connection, subscription_id: str, project_id: Optional[str] = None, project_name: Optional[str] = None)

Bases: mstrio.utils.entity.EntityBase

Class representation of MicroStrategy Subscription object.

id

The ID of the Subscription

connection

The MicroStrategy connection object

project_id

The ID of the project the Subscription belongs to

add_recipient(recipients: Optional[Union[List[dict], dict, List[str], str]] = None, recipient_id: Optional[str] = None, recipient_type: Optional[str] = None, recipient_include_type: str = 'TO')

Adds recipient to subscription. You can either specify id, type and include_type of single recipient, or just pass recipients list as a list of dictionaries.

Parameters
  • recipients

    list of ids or dicts containing recipients, dict format: {“id”: recipient_id,

    ”type”: “CONTACT_GROUP” / “USER_GROUP” / “CONTACT” /

    ”USER” / “PERSONAL_ADDRESS” / “UNSUPPORTED”

    ”includeType”: “TO” / “CC” / “BCC”}

  • recipient_id – id of the recipient

  • recipient_type – type of the recipient

  • recipient_include_type – include type of the recipient one of the following: “TO” / “CC” / “BCC”, by default “TO”

alter(name: typing.Optional[str] = None, allow_delivery_changes: typing.Optional[bool] = None, allow_personalization_changes: typing.Optional[bool] = None, allow_unsubscribe: typing.Optional[bool] = None, send_now: bool = False, owner_id: typing.Optional[str] = None, schedules: typing.Optional[typing.Union[str, typing.List[str], mstrio.distribution_services.schedule.schedule.Schedule, typing.List[mstrio.distribution_services.schedule.schedule.Schedule]]] = None, contents: typing.Optional[mstrio.distribution_services.subscription.content.Content] = None, recipients: typing.Optional[typing.Union[typing.List[str], typing.List[dict]]] = None, delivery: typing.Optional[typing.Union[mstrio.distribution_services.subscription.delivery.Delivery, dict]] = None, delivery_mode: typing.Optional[str] = None, custom_msg: typing.Optional[str] = None, delivery_expiration_date: typing.Optional[str] = None, contact_security: typing.Optional[bool] = None, filename: typing.Optional[str] = None, compress: typing.Optional[bool] = None, space_delimiter: typing.Optional[str] = None, email_subject: typing.Optional[str] = None, email_message: typing.Optional[str] = None, email_send_content_as: typing.Optional[str] = None, overwrite_older_version: typing.Optional[bool] = None, zip_filename: typing.Optional[str] = None, zip_password_protect: typing.Optional[bool] = None, zip_password: typing.Optional[str] = None, file_burst_sub_folder: typing.Optional[str] = None, printer_copies: typing.Optional[int] = None, printer_range_start: typing.Optional[int] = None, printer_range_end: typing.Optional[int] = None, printer_collated: typing.Optional[bool] = None, printer_orientation: typing.Optional[str] = None, printer_use_print_range: typing.Optional[bool] = None, cache_cache_type: typing.Optional[str] = None, cache_shortcut_cache_format: typing.Optional[str] = None, mobile_client_type: typing.Optional[str] = None, device_id: typing.Optional[str] = None, do_not_create_update_caches: typing.Optional[bool] = None, re_run_hl: typing.Optional[bool] = None, cache_library_cache_types: typing.List[typing.Union[mstrio.distribution_services.subscription.delivery.LibraryCacheTypes, str]] = [<LibraryCacheTypes.WEB: 'web'>], cache_reuse_dataset_cache: bool = False, cache_is_all_library_users: bool = False, delivery_notification_enabled: bool = False, delivery_personal_notification_address_id: typing.Optional[str] = None)

Alter subscription.

Parameters
  • connection (Connection) – a MicroStrategy connection object

  • name (str) – name of the subscription,

  • project_id (str) – project ID,

  • allow_delivery_changes (bool) – whether the recipients can change the delivery of the subscription,

  • allow_personalization_changes (bool) – whether the recipients can personalize the subscription,

  • allow_unsubscribe (bool) – whether the recipients can unsubscribe from the subscription,

  • send_now (bool) – indicates whether to execute the subscription immediately,

  • owner_id (str) – ID of the subscription owner, by default logged in user ID,

  • schedules (Union[str, List[str], Schedule, List[Schedule]]) – Schedules IDs or Schedule objects,

  • contents (Content) – The content of the subscription.

  • recipients (Union[List[str], List[dict]]) – list of recipients IDs or dicts,

  • delivery_mode (str, enum) – the subscription delivery mode [EMAIL, FILE, PRINTER, HISTORY_LIST, CACHE, MOBILE, FTP, SNAPSHOT, PERSONAL_VIEW, SHARED_LINK, UNSUPPORTED],

  • delivery_expiration_date (str) – expiration date of the subscription, format should be yyyy-MM-dd,

  • contact_security (bool) – whether to use contact security for each contact group member,

  • filename (str) – the filename that will be delivered when the subscription is executed,

  • compress (bool) – whether to compress the file

  • space_delimiter (str) – space delimiter,

  • email_subject (str) – email subject associated with the subscription,

  • email_message (str) – email body of subscription,

  • email_send_content_as (str,enum) – [data, data_and_history_list, data_and_link_and_history_list, link_and_history_list],

  • overwrite_older_version (bool) – whether the current subscription will overwrite earlier versions of the same report or document in the history list,

  • zip_filename (str) – filename of the compressed content,

  • zip_password_protect (bool) – whether to password protect zip file,

  • zip_password (str) – optional password for the compressed file

  • file_burst_sub_folder (str) – burst sub folder,

  • printer_copies (int) – the number of copies that should be printed,

  • printer_range_start (int) – the number indicating the first report page that should be printed,

  • printer_range_end (int) – the number indicating the last report page that should be printed,

  • printer_collated (bool) – whether the printing should be collated,

  • printer_orientation (str,enum) – [ PORTRAIT, LANDSCAPE ]

  • printer_use_print_range (bool) – whether print range should be used,

  • cache_cache_type (str,enum) – [RESERVED, SHORTCUT, SHORTCUTWITHBOOKMARK]

  • cache_shortcut_cache_format (str,enum) – [RESERVED, JSON, BINARY, BOTH]

  • mobile_client_type (str,enum) – [RESERVED, BLACKBERRY, PHONE, TABLET, ANDROID]

  • device_id (str) – the mobile target project,

  • do_not_create_update_caches (bool) – whether the current subscription will overwrite earlier versions of the same report or document in the history list,

  • re_run_hl (bool) – whether subscription will re-run against warehouse

  • cache_library_cache_types – Set of library cache types, available types can be web, android, ios

  • cache_reuse_dataset_cache – Whether to reuse dataset cache

  • cache_is_all_library_users – Whether for all library users

  • delivery_notification_enabled – Whether notification is enabled, notification applies to cache

  • delivery_personal_notification_address_id – Notification details

available_bursting_attributes() dict

Get a list of available attributes for bursting feature.

available_recipients() List[dict]

List available recipients for subscription content.

delete(force: bool = False) bool

Delete a subscription. Returns True if deletion was successful.

Parameters

force – If True, no additional prompt will be shown before deleting

execute()

Executes a subscription with given name or GUID for given project.

classmethod from_dict(source: Optional[Dict[str, Any]] = None, connection: Optional[mstrio.connection.Connection] = None, project_id: Optional[str] = None, project_name: Optional[str] = None) mstrio.distribution_services.subscription.base_subscription.T

Initialize Subscription object from dictionary. Specify either project_id or project_name. When project_id is provided (not None), project_name is omitted.

list_properties()

Lists all properties of subscription.

remove_recipient(recipients)

Removes recipient from given subscription in given project.

Parameters

recipients

list of ids or dicts containing recipients, dict format: {“id”: recipient_id,

”type”: “CONTACT_GROUP” / “USER_GROUP” / “CONTACT” /

”USER” / “PERSONAL_ADDRESS” / “UNSUPPORTED”

”includeType”: “TO” / “CC” / “BCC”}

mstrio.distribution_services.subscription.cache_update_subscription module

class mstrio.distribution_services.subscription.cache_update_subscription.CacheUpdateSubscription(connection: mstrio.connection.Connection, subscription_id: Optional[str] = None, project_id: Optional[str] = None, project_name: Optional[str] = None)

Bases: mstrio.distribution_services.subscription.base_subscription.Subscription

Class representation of MicroStrategy Cache Update Subscription object.

alter(name: typing.Optional[str] = None, allow_delivery_changes: typing.Optional[bool] = None, allow_personalization_changes: typing.Optional[bool] = None, allow_unsubscribe: typing.Optional[bool] = None, send_now: typing.Optional[bool] = None, owner_id: typing.Optional[str] = None, schedules: typing.Optional[typing.Union[str, typing.List[str], mstrio.distribution_services.schedule.schedule.Schedule, typing.List[mstrio.distribution_services.schedule.schedule.Schedule]]] = None, contents: typing.Optional[mstrio.distribution_services.subscription.content.Content] = None, recipients: typing.Optional[typing.Union[typing.List[str], typing.List[dict]]] = None, delivery: typing.Optional[typing.Union[mstrio.distribution_services.subscription.delivery.Delivery, dict]] = None, custom_msg=None, delivery_expiration_date: typing.Optional[str] = None, contact_security: bool = True, cache_cache_type: typing.Union[mstrio.distribution_services.subscription.delivery.CacheType, str] = CacheType.RESERVED, cache_shortcut_cache_format: typing.Union[mstrio.distribution_services.subscription.delivery.ShortcutCacheFormat, str] = ShortcutCacheFormat.RESERVED, cache_library_cache_types: typing.List[typing.Union[mstrio.distribution_services.subscription.delivery.LibraryCacheTypes, str]] = [<LibraryCacheTypes.WEB: 'web'>], cache_reuse_dataset_cache: bool = False, cache_is_all_library_users: bool = False, delivery_notification_enabled: bool = False, delivery_personal_notification_address_id: typing.Optional[str] = None)

Alter the subscription.

Parameters
  • name – name of the subscription,

  • allow_delivery_changes – whether the recipients can change the delivery of the subscription,

  • allow_personalization_changes – whether the recipients can personalize the subscription,

  • allow_unsubscribe – whether the recipients can unsubscribe from the subscription,

  • send_now – indicates whether to execute the subscription immediately,

  • owner_id – ID of the subscription owner, by default logged in user ID,

  • schedules – Schedules IDs or Schedule objects,

  • contents – The content settings.

  • recipients – list of recipients IDs or dicts,

  • delivery – delivery object or dict

  • delivery_expiration_date – expiration date of the subscription, format should be yyyy - MM - dd,

  • contact_security – whether to use contact security for each contact group member

  • cache_cache_type – [RESERVED, SHORTCUT, SHORTCUTWITHBOOKMARK]

  • cache_shortcut_cache_format – [RESERVED, JSON, BINARY, BOTH]

  • cache_library_cache_types – Set of library cache types, available types can be web, android, ios

  • cache_reuse_dataset_cache – Whether to reuse dataset cache

  • cache_is_all_library_users – Whether for all library users

  • delivery_notification_enabled – Whether notification is enabled, notification applies to cache

  • delivery_personal_notification_address_id – Notification details

classmethod create(connection: mstrio.connection.Connection, name: str, project_id: typing.Optional[str] = None, project_name: typing.Optional[str] = None, allow_delivery_changes: typing.Optional[bool] = None, allow_personalization_changes: typing.Optional[bool] = None, allow_unsubscribe: typing.Optional[bool] = None, send_now: typing.Optional[bool] = None, owner_id: typing.Optional[str] = None, schedules: typing.Optional[typing.Union[str, typing.List[str], mstrio.distribution_services.schedule.schedule.Schedule, typing.List[mstrio.distribution_services.schedule.schedule.Schedule]]] = None, contents: typing.Optional[mstrio.distribution_services.subscription.content.Content] = None, recipients: typing.Optional[typing.Union[typing.List[str], typing.List[dict]]] = None, delivery: typing.Optional[typing.Union[mstrio.distribution_services.subscription.delivery.Delivery, dict]] = None, delivery_expiration_date: typing.Optional[str] = None, contact_security: bool = True, cache_cache_type: typing.Union[mstrio.distribution_services.subscription.delivery.CacheType, str] = CacheType.RESERVED, cache_shortcut_cache_format: typing.Union[mstrio.distribution_services.subscription.delivery.ShortcutCacheFormat, str] = ShortcutCacheFormat.RESERVED, cache_library_cache_types: typing.List[typing.Union[mstrio.distribution_services.subscription.delivery.LibraryCacheTypes, str]] = [<LibraryCacheTypes.WEB: 'web'>], cache_reuse_dataset_cache: bool = False, cache_is_all_library_users: bool = False, delivery_notification_enabled: bool = False, delivery_personal_notification_address_id: typing.Optional[str] = None) mstrio.distribution_services.subscription.cache_update_subscription.CacheUpdateSubscription

Creates a new cache update subscription.

Parameters
  • connection – a MicroStrategy connection object

  • name – name of the subscription,

  • project_id – project ID,

  • project_name – project name,

  • allow_delivery_changes – whether the recipients can change the delivery of the subscription,

  • allow_personalization_changes – whether the recipients can personalize the subscription,

  • allow_unsubscribe – whether the recipients can unsubscribe from the subscription,

  • send_now – indicates whether to execute the subscription immediately,

  • owner_id – ID of the subscription owner, by default logged in user ID,

  • schedules – Schedules IDs or Schedule objects,

  • contents – The content settings.

  • recipients – list of recipients IDs or dicts,

  • delivery – delivery object or dict

  • delivery_expiration_date – expiration date of the subscription, format should be yyyy - MM - dd,

  • contact_security – whether to use contact security for each contact group member

  • cache_cache_type – [RESERVED, SHORTCUT, SHORTCUTWITHBOOKMARK]

  • cache_shortcut_cache_format – [RESERVED, JSON, BINARY, BOTH]

  • cache_library_cache_types – Set of library cache types, available types can be web, android, ios

  • cache_reuse_dataset_cache – Whether to reuse dataset cache

  • cache_is_all_library_users – Whether for all library users

  • delivery_notification_enabled – Whether notification is enabled, notification applies to cache

  • delivery_personal_notification_address_id – Notification details

mstrio.distribution_services.subscription.common module

class mstrio.distribution_services.subscription.common.RefreshPolicy(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

ADD = 'add'
DELETE = 'delete'
REPLACE = 'replace'
UPDATE = 'update'
UPSERT = 'upsert'

mstrio.distribution_services.subscription.content module

class mstrio.distribution_services.subscription.content.Content(id: str, type: mstrio.distribution_services.subscription.content.Content.Type, name: Optional[str] = None, personalization: Optional[mstrio.distribution_services.subscription.content.Content.Properties] = None, refresh_condition: Optional[mstrio.distribution_services.subscription.content.Content.RefreshCondition] = None)

Bases: mstrio.utils.helper.Dictable

Class representation of subscription content object.

id

Content identifier

type

Type of content

name

Name of content

personalization

Properties object which personalize content

refresh_condition

RefreshCondition object which sets refresh condition of the content

class Properties(format_mode: mstrio.distribution_services.subscription.content.Content.Properties.FormatMode = FormatMode.DEFAULT, view_mode: mstrio.distribution_services.subscription.content.Content.Properties.ViewMode = ViewMode.DEFAULT, format_type: mstrio.distribution_services.subscription.content.Content.Properties.FormatType = FormatType.PDF, export_to_pdf_settings: Optional[mstrio.distribution_services.subscription.content.Content.Properties.ExportToPdfSettings] = None, delimiter: Optional[str] = None, bursting: Optional[mstrio.distribution_services.subscription.content.Content.Properties.Bursting] = None, prompt: Optional[mstrio.distribution_services.subscription.content.Content.Properties.Prompt] = None, file_name: Optional[str] = None)

Bases: mstrio.utils.helper.Dictable

Class representation of personalization properties

format_mode

Type that defines how much of the Report Services document, which has group by units, should be delivered

view_mode

Indicates the view mode that is supported by this format

format_type

Content format mode

export_to_pdf_settings

ExportToPdfSettings object which specifies pdf settings if format_type is set to PDF

delimiter

Format delimiter

bursting

Bursting settings object

prompt

Promp settings object

file_name

file name of content

class Bursting(slicing_attributes: Optional[List[str]] = None, address_attribute_id: Optional[str] = None, device_id: Optional[str] = None, form_id: Optional[str] = None)

Bases: mstrio.utils.helper.Dictable

Bursting settings

slicing_attributes

The list of attributes to slice on

address_attribute_id

Attribute ID in the email burst feature

device_id

Device ID in the email burst feature

form_id

Form ID in the email burst feature

class ExportToPdfSettings(page_option: mstrio.distribution_services.subscription.content.Content.Properties.ExportToPdfSettings.PageOption = PageOption.PAGE, page_size: mstrio.distribution_services.subscription.content.Content.Properties.ExportToPdfSettings.PageSize = PageSize.LETTER, orientation: mstrio.distribution_services.subscription.content.Content.Properties.ExportToPdfSettings.Orientation = Orientation.AUTOMATIC, page_detail_level=PageDetailLevel.OVERVIEW, include_header: bool = True, include_footer: bool = True, include_toc: bool = False, filter_summary: mstrio.distribution_services.subscription.content.Content.Properties.ExportToPdfSettings.FilterSummary = FilterSummary.BAR, fit_to_page: bool = False, repeat_column_header: bool = False, grid_paging_mode: mstrio.distribution_services.subscription.content.Content.Properties.ExportToPdfSettings.GridPagingMode = GridPagingMode.NONE)

Bases: mstrio.utils.helper.Dictable

Export to PDF Settings

page_option

Specifies whether to export current page or all pages

page_size

Page size of the PDF file

orientation

Page orientation. If ‘auto’ is being used, the exporting engine might swap the width and the height of the page to optimize the export

page_detail_level

Specifies the detail level of page to be displayed

include_header

Specifies whether to include header

Specifies whether to include footer

include_toc

Specifies whether to include table of contents

filter_summary

Specifies the options of including filter summary in the exported PDF. If ‘NONE’ is being used, no filter summary will be displayed. If ‘BAR’ is being used, filter summary bar will be displayed on each page. If ‘PAGE’ is being used, filter summary page will be displayed at the end of each chapter. If ‘ALL’ is being used, both filter summary bar and page will be displayed.

fit_to_page

Specifies whether to fit grid to page

repeat_column_header

Specifies whether to repeat grid column header

grid_paging_mode

Specifies how grids should be paginated

class FilterSummary(value)

Bases: mstrio.utils.enum_helper.AutoUpperName

An enumeration.

ALL = 'ALL'
BAR = 'BAR'
NONE = 'NONE'
PAGE = 'PAGE'
class GridPagingMode(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

ENLARGE = 'enlarge'
NONE = 'none'
class Orientation(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

AUTOMATIC = 'automatic'
LANDSCAPE = 'landscape'
PORTRAIT = 'portrait'
class PageDetailLevel(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

DETAILED_PAGES = 'detailed_pages'
OVERVIEW = 'overview'
OVERVIEW_AND_DETAILED_PAGES = 'overview_and_detailed_pages'
class PageOption(value)

Bases: mstrio.utils.enum_helper.AutoUpperName

An enumeration.

ALL = 'ALL'
CURRENT = 'CURRENT'
DEFAULT = 'DEFAULT'
PAGE = 'PAGE'
class PageSize(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

A3 = 'a3'
A4 = 'a4'
A5 = 'a5'
B4 = 'b4'
B5 = 'b5'
EXECUTIVE = 'executive'
FOLIO = 'folio'
LEDGER = 'ledger'
LEGAL = 'legal'
LETTER = 'letter'
STATEMENT = 'statement'
UNSUPPORTED = 'unsupported'
class FormatMode(value)

Bases: mstrio.utils.enum_helper.AutoUpperName

An enumeration.

ALL_PAGES = 'ALL_PAGES'
ALL_PAGES_SEPARATED = 'ALL_PAGES_SEPARATED'
CURRENT_LAYOUT = 'CURRENT_LAYOUT'
CURRENT_PAGE = 'CURRENT_PAGE'
CURRENT_WINDOW = 'CURRENT_WINDOW'
DEFAULT = 'DEFAULT'
class FormatType(value)

Bases: mstrio.utils.enum_helper.AutoUpperName

An enumeration.

CSV = 'CSV'
EDITABLE = 'EDITABLE'
EXCEL = 'EXCEL'
EXPORT_FLASH = 'EXPORT_FLASH'
HTML = 'HTML'
INTERACTIVE = 'INTERACTIVE'
JSON = 'JSON'
MSTR = 'MSTR'
PDF = 'PDF'
PHONE = 'PHONE'
PLAIN_TEXT = 'PLAIN_TEXT'
STREAMING = 'STREAMING'
SWF_HTML = 'SWF_HTML'
SWF_MHT = 'SWF_MHT'
TABLET = 'TABLET'
VIEW = 'VIEW'
class Prompt(enabled: bool, instance_id: Optional[str] = None)

Bases: mstrio.utils.helper.Dictable

class ViewMode(value)

Bases: mstrio.utils.enum_helper.AutoUpperName

An enumeration.

BOTH = 'BOTH'
DEFAULT = 'DEFAULT'
GRAPH = 'GRAPH'
GRID = 'GRID'
NONINTERACTIVE = 'NONINTERACTIVE'
class RefreshCondition(tables: List[mstrio.distribution_services.subscription.content.Content.RefreshCondition.TableRefreshInfo], dataset_refresh_policy: Optional[mstrio.distribution_services.subscription.common.RefreshPolicy] = None, filters: Optional[List[mstrio.distribution_services.subscription.content.Content.RefreshCondition.SubscriptionFilter]] = None)

Bases: mstrio.utils.helper.Dictable

Dataset refresh condition settings

tables

List of TableRefreshInfo objects

dataset_refresh_policy

Default refresh policy for all the tables in the dataset. The setting value must be provided if the tables setting value is not provided or empty.

filters

list of SubscriptionFilter objects

class SubscriptionFilter(type: str, expression)

Bases: mstrio.utils.helper.Dictable

Subscription filter. The format of the subscription filters are

exactly the same as the view filters. Please refer to https://lw.microstrategy.com/msdz/MSDL/GARelease_Current/docs/projects/RESTSDK/Content/topics/REST_API/REST_API_Filtering_RptsCubes_ViewFilter_CodeSamples.htm#multiple_filters_on_attribute_forms for detailed information. But itshould be noted that subscription filters only support Filter on attribute forms and Multiple filters on attribute forms.

type

Filter type

expression

Metric limits

class TableRefreshInfo(id: str, refresh_policy: mstrio.distribution_services.subscription.common.RefreshPolicy, alternate_source: Optional[mstrio.distribution_services.subscription.content.Content.RefreshCondition.TableRefreshInfo.AlternateSource] = None)

Bases: mstrio.utils.helper.Dictable

Table refresh settings. When the setting is absent in the

response or the array is empty, the datasetRefreshPolicy setting value must be provided and will be used as the refresh policy for all the tables, including the new added table after the scheduler is set up.

id

Table ID

refresh_policy

Table refresh policy

alternateSource

AlternateSource object

class AlternateSource(db_role_id: Optional[str] = None, namespace: Optional[str] = None, table_name: Optional[str] = None, url: Optional[str] = None)

Bases: mstrio.utils.helper.Dictable

Alternate source

db_role_id

Database instance ID of alternate source

namespace

Database namespace of alternate source

table_name

Table name of alternate source

url

URL of alternate source

class Type(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

CUBE = 'cube'
DOCUMENT = 'document'
DOSSIER = 'dossier'
REPORT = 'report'
UNSUPPORTED = 'unsupported'

mstrio.distribution_services.subscription.delivery module

class mstrio.distribution_services.subscription.delivery.CacheType(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

RESERVED = 'reserved'
SHORTCUT = 'shortcut'
SHORTCUTWITHBOOKMARK = 'shortcut_and_bookmark'
class mstrio.distribution_services.subscription.delivery.ClientType(value)

Bases: mstrio.utils.enum_helper.AutoUpperName

An enumeration.

ANDROID = 'ANDROID'
BLACKBERRY = 'BLACKBERRY'
PHONE = 'PHONE'
RESERVED = 'RESERVED'
TABLET = 'TABLET'
class mstrio.distribution_services.subscription.delivery.Delivery(mode='EMAIL', expiration: typing.Optional[str] = None, contact_security: typing.Optional[bool] = None, subject: typing.Optional[str] = None, message: typing.Optional[str] = None, filename: typing.Optional[str] = None, compress: bool = False, zip: typing.Optional[mstrio.distribution_services.subscription.delivery.ZipSettings] = None, password: typing.Optional[str] = None, password_protect: bool = False, space_delimiter: typing.Optional[str] = None, send_content_as: mstrio.distribution_services.subscription.delivery.SendContentAs = SendContentAs.DATA, overwrite_older_version: bool = False, burst_sub_folder: typing.Optional[str] = None, copies: typing.Optional[int] = None, range_start: typing.Optional[int] = None, range_end: typing.Optional[int] = None, collated: bool = False, orientation: mstrio.distribution_services.subscription.delivery.Orientation = 'PORTRAIT', use_print_range: bool = False, client_type: mstrio.distribution_services.subscription.delivery.ClientType = 'RESERVED', device_id: typing.Optional[str] = None, do_not_create_update_caches: bool = False, re_run_hl: bool = False, email: typing.Optional[mstrio.distribution_services.subscription.delivery.Delivery.Email] = None, file: typing.Optional[mstrio.distribution_services.subscription.delivery.Delivery.File] = None, cache_type: typing.Union[mstrio.distribution_services.subscription.delivery.CacheType, str] = CacheType.RESERVED, shortcut_cache_format: typing.Union[mstrio.distribution_services.subscription.delivery.ShortcutCacheFormat, str] = ShortcutCacheFormat.RESERVED, library_cache_types: typing.List[typing.Union[mstrio.distribution_services.subscription.delivery.LibraryCacheTypes, str]] = [<LibraryCacheTypes.WEB: 'web'>], reuse_dataset_cache: bool = False, is_all_library_users: bool = False, notification_enabled: bool = False, personal_notification_address_id: typing.Optional[str] = None)

Bases: mstrio.distribution_services.subscription.delivery.DeliveryDictable

Delivery settings object

mode

The subscription delivery mode (i.e. email, file, printer, etc.)

expiration

Expiration date of the subscription, format should be yyyy-MM-dd

contact_security

Whether to use contact security for each contact group member

email

Email delivery properties object

file

File delivery properties object

printer

File delivery properties object

ftp

FTP delivery properties object

cache

Cache delivery properties

mobile

Mobile delivery properties object

history_list

HistoryList delivery properties

class Cache(cache_type: mstrio.distribution_services.subscription.delivery.CacheType = CacheType.RESERVED, shortcut_cache_format: mstrio.distribution_services.subscription.delivery.ShortcutCacheFormat = ShortcutCacheFormat.RESERVED, library_cache_types: Optional[List[mstrio.distribution_services.subscription.delivery.LibraryCacheTypes]] = None, reuse_dataset_cache: bool = False, is_all_library_users: bool = False)

Bases: mstrio.distribution_services.subscription.delivery.DeliveryDictable

Delivery properties for Cache subscriptions

cache_type

The cache type to use

shortcut_cache_format

The shortcut cache format to use

library_cache_types

Set of library cache types, available types can be web, android, ios

reuse_dataset_cache

Whether to reuse dataset cache

is_all_library_users

Whether for all library users

VALIDATION_DICT = {'is_all_library_users': [<class 'bool'>, False], 'library_cache_types': [<class 'list'>, False], 'reuse_dataset_cache': [<class 'bool'>, False]}
class DeliveryMode(value)

Bases: mstrio.utils.enum_helper.AutoUpperName

An enumeration.

CACHE = 'CACHE'
EMAIL = 'EMAIL'
FILE = 'FILE'
FTP = 'FTP'
HISTORY_LIST = 'HISTORY_LIST'
MOBILE = 'MOBILE'
PERSONAL_VIEW = 'PERSONAL_VIEW'
PRINTER = 'PRINTER'
SNAPSHOT = 'SNAPSHOT'
UNSUPPORTED = 'UNSUPPORTED'
class Email(subject: Optional[str] = None, message: Optional[str] = None, filename: Optional[str] = None, space_delimiter: Optional[str] = None, send_content_as: Optional[mstrio.distribution_services.subscription.delivery.SendContentAs] = None, overwrite_older_version: bool = False, zip: Optional[mstrio.distribution_services.subscription.delivery.ZipSettings] = None)

Bases: mstrio.distribution_services.subscription.delivery.DeliveryDictable

Delivery properties for Email subscriptions

subject

The email subject associated with the subscription

message

The email body of subscription

filename

The filename that will be delivered when the subscription is executed

space_delimiter

The space delimiter

send_content_as

Send subscribed content as one of [data, data_and_history_list, data_and_link_and_history_list, link_and_history_list]

overwrite_older_version

Whether the current subscription will overwrite earlier versions of the same report or document in the history list

zip

Optional compression settings object

VALIDATION_DICT = {'filename': [<class 'str'>, False], 'message': [<class 'str'>, False], 'overwrite_older_version': [<class 'bool'>, False], 'send_content_as': [<class 'str'>, False], 'space_delimiter': [<class 'str'>, False], 'subject': [<class 'str'>, True], 'zip': [<class 'mstrio.distribution_services.subscription.delivery.ZipSettings'>, False]}
validate()
class File(filename: Optional[str] = None, space_delimiter: Optional[str] = None, burst_sub_folder: Optional[str] = None, zip: Optional[mstrio.distribution_services.subscription.delivery.ZipSettings] = None)

Bases: mstrio.distribution_services.subscription.delivery.DeliveryDictable

Delivery properties for File subscriptions

filename

The filename that will be delivered when the subscription is executed

space_delimiter

The space delimiter

burst_sub_folder

The burst sub folder

zip

Optional compression settings object

VALIDATION_DICT = {'burst_sub_folder': [<class 'str'>, False], 'filename': [<class 'str'>, False], 'space_delimiter': [<class 'str'>, False], 'zip': [<class 'mstrio.distribution_services.subscription.delivery.ZipSettings'>, False]}
class Ftp(space_delimiter: Optional[str] = None, filename: Optional[str] = None, zip: Optional[mstrio.distribution_services.subscription.delivery.ZipSettings] = None)

Bases: mstrio.distribution_services.subscription.delivery.DeliveryDictable

Delivery properties for FTP subscriptions

filename

The filename that will be delivered when the subscription is executed

space_delimiter

The space delimiter

zip

Optional compression settings object

VALIDATION_DICT = {'filename': [<class 'str'>, False], 'space_delimiter': [<class 'str'>, False], 'zip': [<class 'mstrio.distribution_services.subscription.delivery.ZipSettings'>, False]}
class HistoryList(device_id: Optional[str] = None, do_not_create_update_caches: bool = False, overwrite_older_version: bool = False, re_run_hl: bool = False)

Bases: mstrio.distribution_services.subscription.delivery.DeliveryDictable

Delivery properties for History List subscriptions

device_id

The mobile target project

do_not_create_update_caches

Whether the subscription will use a existing cache

overwrite_older_version

Whether the current subscription will overwrite earlier versions of the same report or document in the history list

re_run_hl

Whether the subscription will re-run against warehouse

VALIDATION_DICT = {'device_id': [<class 'str'>, False], 'do_not_create_update_caches': [<class 'bool'>, False], 'overwrite_older_version': [<class 'bool'>, False], 're_run_hl': [<class 'bool'>, False]}
class Mobile(client_type: mstrio.distribution_services.subscription.delivery.ClientType = 'RESERVED', device_id: Optional[str] = None, do_not_create_update_caches: bool = False, overwrite_older_version: bool = False, re_run_hl: bool = False)

Bases: mstrio.distribution_services.subscription.delivery.DeliveryDictable

Delivery properties for Mobile subscriptions

client_type

The mobile client type

device_id

The mobile target project

do_not_create_update_caches

Whether the subscription will use a existing cache

overwrite_older_version

Whether the current subscription will overwrite earlier versions of the same report or document in the history list

re_run_hl

Whether the subscription will re-run against warehouse

VALIDATION_DICT = {'client_type': [<class 'str'>, False], 'device_id': [<class 'str'>, False], 'do_not_create_update_caches': [<class 'bool'>, False], 'overwrite_older_version': [<class 'bool'>, False], 're_run_hl': [<class 'bool'>, False]}
class Printer(copies: Optional[int] = None, range_start: Optional[int] = None, range_end: Optional[int] = None, collated: bool = False, orientation: mstrio.distribution_services.subscription.delivery.Orientation = 'PORTRAIT', use_print_range: bool = False)

Bases: mstrio.distribution_services.subscription.delivery.DeliveryDictable

Delivery properties for Printer subscriptions

copies

The number of copies that should be printed

range_start

The number indicating the first report page that should be printed

range_end

The number indicating the last report page that should be printed

collated

Whether the printing should be collated or not

orientation

Whether orientation is portrait or landscape

use_print_range

Whether a print range should be used

VALIDATION_DICT = {'collated': [<class 'bool'>, False], 'copies': [<class 'int'>, False], 'orientation': [<class 'str'>, False], 'range_end': [<class 'int'>, False], 'range_start': [<class 'int'>, False], 'use_print_range': [<class 'bool'>, False]}
VALIDATION_DICT = {'cache': [<class 'mstrio.distribution_services.subscription.delivery.Delivery.Cache'>, False], 'contact_security': [<class 'bool'>, False], 'email': [<class 'mstrio.distribution_services.subscription.delivery.Delivery.Email'>, False], 'expiration': [<class 'str'>, False], 'file': [<class 'mstrio.distribution_services.subscription.delivery.Delivery.File'>, False], 'ftp': [<class 'mstrio.distribution_services.subscription.delivery.Delivery.Ftp'>, False], 'history_list': [<class 'mstrio.distribution_services.subscription.delivery.Delivery.HistoryList'>, False], 'mobile': [<class 'mstrio.distribution_services.subscription.delivery.Delivery.Mobile'>, False], 'mode': [<class 'str'>, True], 'printer': [<class 'mstrio.distribution_services.subscription.delivery.Delivery.Printer'>, False]}
change_mode(mode_name: str, mode_value) bool

Change mode of the Delivery object. Return True on success, False if mode_name was invalid.

classmethod from_dict(source, **kwargs)

Initialize Delivery object from dictionary.

class mstrio.distribution_services.subscription.delivery.DeliveryDictable

Bases: mstrio.utils.helper.Dictable

VALIDATION_DICT = {}
classmethod from_dict(source, **kwargs)

Initialize Delivery object from dictionary.

validate()
class mstrio.distribution_services.subscription.delivery.LibraryCacheTypes(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

ANDROID = 'android'
ANDROID_AND_IOS = 'android_and_ios'
IOS = 'ios'
WEB = 'web'
class mstrio.distribution_services.subscription.delivery.Orientation(value)

Bases: mstrio.utils.enum_helper.AutoUpperName

An enumeration.

LANDSCAPE = 'LANDSCAPE'
PORTRAIT = 'PORTRAIT'
class mstrio.distribution_services.subscription.delivery.SendContentAs(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

DATA = 'data'
DATA_AND_HISTORY_LIST = 'data_and_history_list'
class mstrio.distribution_services.subscription.delivery.ShortcutCacheFormat(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

BINARY = 'binary'
BOTH = 'both'
JSON = 'json'
RESERVED = 'reserved'
class mstrio.distribution_services.subscription.delivery.ZipSettings(filename: Optional[str] = None, password: Optional[str] = None, password_protect: bool = False)

Bases: mstrio.distribution_services.subscription.delivery.DeliveryDictable

Optional compression settings

filename

Filename of the compressed content

password

Optional password for the compressed file

password_protect

Whether to password protect file or not

VALIDATION_DICT = {'filename': [<class 'str'>, False], 'password': [<class 'str'>, False], 'password_protect': [<class 'bool'>, False]}

mstrio.distribution_services.subscription.email_subscription module

class mstrio.distribution_services.subscription.email_subscription.EmailSubscription(connection: mstrio.connection.Connection, subscription_id: Optional[str] = None, project_id: Optional[str] = None, project_name: Optional[str] = None)

Bases: mstrio.distribution_services.subscription.base_subscription.Subscription

Class representation of MicroStrategy Email Subscription object.

classmethod create(connection: mstrio.connection.Connection, name: str, project_id: Optional[str] = None, project_name: Optional[str] = None, allow_delivery_changes: Optional[bool] = None, allow_personalization_changes: Optional[bool] = None, allow_unsubscribe: bool = True, send_now: Optional[bool] = None, owner_id: Optional[str] = None, schedules: Optional[Union[str, List[str], mstrio.distribution_services.schedule.schedule.Schedule, List[mstrio.distribution_services.schedule.schedule.Schedule]]] = None, contents: Optional[mstrio.distribution_services.subscription.content.Content] = None, recipients: Optional[Union[List[str], List[dict]]] = None, delivery_expiration_date: Optional[str] = None, contact_security: Optional[bool] = None, space_delimiter: Optional[str] = None, email_subject: Optional[str] = None, email_message: Optional[str] = None, email_send_content_as: str = 'data', overwrite_older_version: bool = False, filename: Optional[str] = None, compress: bool = False, zip_filename: Optional[str] = None, zip_password_protect: Optional[bool] = None, zip_password: Optional[str] = None)

Creates a new email subscription.

Parameters
  • connection (Connection) – a MicroStrategy connection object

  • name (str) – name of the subscription,

  • project_id (str) – project ID,

  • project_name (str) – project name,

  • allow_delivery_changes (bool) – whether the recipients can change the delivery of the subscription,

  • allow_personalization_changes (bool) – whether the recipients can personalize the subscription,

  • allow_unsubscribe (bool) – whether the recipients can unsubscribe from the subscription,

  • send_now (bool) – indicates whether to execute the subscription immediately,

  • owner_id (str) – ID of the subscription owner, by default logged in user ID,

  • schedules (Union[str, List[str], Schedule, List[Schedule]]) – Schedules IDs or Schedule objects,

  • contents (Content) – The content settings.

  • recipients (Union[List[str], List[dict]]) – list of recipients IDs or dicts,

  • delivery_expiration_date (str) – expiration date of the subscription, format should be yyyy - MM - dd,

  • contact_security (bool) – whether to use contact security for each contact group member,

  • filename (str) – the filename that will be delivered when the subscription is executed,

  • compress (bool) – whether to compress the file

  • space_delimiter (str) – space delimiter,

  • email_subject (str) – email subject associated with the subscription,

  • email_message (str) – email body of subscription,

  • email_send_content_as (str, enum) – [data, data_and_history_list, data_and_link_and_history_list, link_and_history_list],

  • overwrite_older_version (bool) – whether the current subscription will overwrite earlier versions of the same report or document in the history list,

  • zip_filename (str) – filename of the compressed content,

  • zip_password_protect (bool) – whether to password protect zip file,

  • zip_password (str) – optional password for the compressed file

mstrio.distribution_services.subscription.subscription_manager module

class mstrio.distribution_services.subscription.subscription_manager.SubscriptionManager(connection: mstrio.connection.Connection, project_id: Optional[str] = None, project_name: Optional[str] = None)

Bases: object

Manage subscriptions.

available_bursting_attributes(content: Union[dict, mstrio.distribution_services.subscription.content.Content])

Get a list of available attributes for bursting feature, for a given content.

Parameters

content – content dictionary or Content object (from subscription.content)

available_recipients(content_id: Optional[str] = None, content_type: Optional[str] = None, content: Optional[mstrio.distribution_services.subscription.content.Content] = None, delivery_type='EMAIL') List[dict]

List available recipients for a subscription contents. Specify either both content_id and content_type or just content object.

Parameters
  • content_id – ID of the content

  • content_type – type of the content

  • content – Content object

  • delivery_type – The delivery of the subscription, available values are: [EMAIL, FILE, PRINTER, HISTORY_LIST, CACHE, MOBILE, FTP].

delete(subscriptions: Union[List[mstrio.distribution_services.subscription.base_subscription.Subscription], List[str]], force=False) bool

Deletes all passed subscriptions. Returns True if successfully removed all subscriptions.

Parameters

subscriptions – list of subscriptions to be deleted

execute(subscriptions: Union[List[mstrio.distribution_services.subscription.base_subscription.Subscription], List[str]])

Executes all passed subscriptions.

Parameters

subscriptions – list of subscriptions to be executed

list_subscriptions(to_dictionary: bool = False, limit: Optional[int] = None, **filters)

Get all subscriptions as list of Subscription objects or dictionaries.

Optionally filter the subscriptions by specifying filters.

Parameters
  • to_dictionary – If True returns a list of subscription dicts, otherwise returns a list of subscription objects

  • limit – limit the number of elements returned. If None (default), all objects are returned.

  • **filters – Available filter parameters: [‘id’, ‘name’, ‘editable’, ‘allowDeliveryChanges’, ‘allowPersonalizationChanges’, ‘allowUnsubscribe’, ‘dateCreated’, ‘dateModified’, ‘owner’, ‘schedules’, ‘contents’, ‘recipients’, ‘delivery’]

mstrio.distribution_services.subscription.subscription_manager.dispatch_from_dict(source: dict, connection: mstrio.connection.Connection, project_id: str)
mstrio.distribution_services.subscription.subscription_manager.get_subscription_type_from_delivery_mode(mode: mstrio.distribution_services.subscription.delivery.Delivery.DeliveryMode)
mstrio.distribution_services.subscription.subscription_manager.list_subscriptions(connection: mstrio.connection.Connection, project_id: Optional[str] = None, project_name: Optional[str] = None, to_dictionary: bool = False, limit: Optional[int] = None, **filters) Union[List[mstrio.distribution_services.subscription.base_subscription.Subscription], List[dict]]

Get all subscriptions per project as list of Subscription objects or dictionaries.

Optionally filter the subscriptions by specifying filters. Specify either project_id or project_name. When project_id is provided (not None), project_name is omitted.

Parameters
  • connection (object) – MicroStrategy connection object

  • project_id – Project ID

  • project_name – Project name

  • to_dictionary – If True returns a list of subscription dicts, otherwise (default) returns a list of subscription objects

  • limit – limit the number of elements returned. If None (default), all objects are returned.

  • **filters – Available filter parameters: [‘id’, ‘name’, ‘editable’, ‘allowDeliveryChanges’, ‘allowPersonalizationChanges’, ‘allowUnsubscribe’, ‘dateCreated’, ‘dateModified’, ‘owner’, ‘schedules’, ‘contents’, ‘recipients’, ‘delivery’]

Module contents