Module macrobond_data_api.web.web_api
Classes
class WebApi
-
Common API to interact with the Macrobond database.
This class defines abstract methods that are implemented for both the Web API and Desktop COM API. You typically access them via an instance ofWebClient
orComClient
.Metadata methods:
Api.metadata_list_values()
Api.metadata_get_attribute_information()
Api.metadata_get_value_information()
Series methods:
Api.get_one_series()
Api.get_series()
Api.get_one_entity()
Api.get_entities()
Api.get_unified_series()
Series revision methods:
Api.get_revision_info()
Api.get_one_vintage_series()
Api.get_vintage_series()
Api.get_one_nth_release()
Api.get_nth_release()
Api.get_all_vintage_series()
Api.get_observation_history()
Search methods:
Api.entity_search()
Api.entity_search_multi_filter()
Ancestors
- Api
- abc.ABC
Instance variables
var session : Session
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
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
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
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
Api
:delete_serie
entity_search
entity_search_multi_filter
get_all_vintage_series
get_entities
get_many_series
get_many_series_with_revisions
get_nth_release
get_observation_history
get_one_entity
get_one_nth_release
get_one_series
get_one_vintage_series
get_revision_info
get_series
get_unified_series
get_vintage_series
metadata_get_attribute_information
metadata_get_value_information
metadata_list_values
raise_error
upload_series