Module macrobond_data_api.web.web_api

Classes

class WebApi

Ancestors

Instance variables

var sessionSession

Methods

def entity_search_multi_filter_long(self: WebApi, *filters: SearchFilter, include_discontinued: bool = False) ‑> SearchResultLong

Search for time series and other entitites. This call can return more results than Api.entity_search_multi_filter(), but is also slower and cannot return any metadata. You can pass more than one search filter. In this case the filters have to use different entity types and searches will be nested so that the result of the previous filter will be used as a condition in the subsequent filter linked by the entity type.

Parameters

*filters : SearchFilter
One or more search filters.
include_discontinued : bool, optional
Set this value to True in order to include discontinued entities in the search.

Returns

A SearchResultLong object containing the names of the entities that match the search filters.

def get_data_package_list(self: WebApi, if_modified_since: Optional[datetime.datetime] = None) ‑> DataPackageList

Get the items in the data package.

Important: For large lists you might want to use get_data_package_list_iterative().

Typically you want to pass the date of time_stamp_for_if_modified_since from response of the previous call to get incremental updates.

Parameters

if_modified_since : datetime
The timestamp of the property time_stamp_for_if_modified_since from the response of the previous call. If not specified, all items will be returned.

Returns

DataPackageList

def get_data_package_list_chunked(self: WebApi, if_modified_since: Optional[datetime.datetime] = None, chunk_size: int = 200) ‑> DataPackageListContextManager

Process the data package list in chunks. This is more efficient since the complete list does not have to be in memory and it can be processed while downloading.

Typically you want to pass the date of time_stamp_for_if_modified_since from response of the previous call to get incremental updates.

Parameters

if_modified_since : datetime, optional
The timestamp of the property time_stamp_for_if_modified_since from the response of the previous call. If not specified, all items will be returned.
chunk_size : int, optional
The maximum number of items to include in each List in DataPackageListContext.items

Returns

DataPackageListContextManager

def get_data_package_list_iterative(self: WebApi, body_callback: Callable[[DataPackageBody], Optional[bool]], items_callback: Callable[[DataPackageBody, List[DataPackageListItem]], Optional[bool]], if_modified_since: Optional[datetime.datetime] = None, buffer_size: int = 200) ‑> Optional[DataPackageBody]

Important: This method is deprecated. Use get_data_package_list_chunked() instead.

Process the data package list in batches. This is more efficient since the complete list does not have to be in memory.

Typically you want to pass the date of time_stamp_for_if_modified_since from response of the previous call to get incremental updates.

Parameters

body_callback : Callable[[DataPackageBody], Optional[bool]]
The callback for the body. This call comes first. Return True to continue processing.
items_callback : Callable[[DataPackageBody, List[DataPackageListItem]], Optional[bool]]
The callback for each batch of items. Return True to continue processing.
if_modified_since : datetime, optional
The timestamp of the property time_stamp_for_if_modified_since from the response of the previous call. If not specified, all items will be returned.
buffer_size : int, optional
The maximum number of items to include in each callback

Returns

DataPackageBody

def subscription_list(self: WebApi, last_modified: datetime.datetime, poll_interval: datetime.timedelta = None) ‑> SubscriptionList

Retrieves the subscription list with the specified date since last update.

Inherited members