Module macrobond_data_api.web.data_package_list_poller

Classes

class DataPackageListPoller (api: WebApi, download_full_list_on_or_after: Optional[datetime.datetime] = None, time_stamp_for_if_modified_since: Optional[datetime.datetime] = None)

This is work in progress and might change soon. Run a loop polling for changed series in the data package list. Derive from this class and override on_full_listing_start, on_full_listing_items, on_full_listing_stop, on_incremental_start, on_incremental_items and on_incremental_stop.

Parameters

api : WebApi
The API instance to use.
download_full_list_on_or_after : datetime
The saved value of download_full_list_on_or_after from the previous run. None on first run.
time_stamp_for_if_modified_since : datetime
The saved value of time_stamp_for_if_modified_since from the previous run. Noneon first run.

Ancestors

  • abc.ABC

Instance variables

var apiWebApi
var download_full_list_on_or_after : Optional[datetime.datetime]

The time of the scheduled next full listing. Save this value after processing and pass in constructor for the next run.

var incomplete_delay

The time to wait, in seconds, between continuing partial updates.

var on_error_delay

The time to wait, in seconds, before retrying after an error.

var time_stamp_for_if_modified_since : Optional[datetime.datetime]

This value is used internall to keep track of the the time of the last detected modification. Save this value after processing and pass in constructor for the next run.

var up_to_date_delay

The time to wait, in seconds, between polls.

Methods

def abort(self) ‑> None

Call this method to stop processing.

def on_full_listing_items(self, subscription: DataPackageBody, items: List[ForwardRef('DataPackageListItem')])

This override is called repeatedly with one or more items until all items are listed.

def on_full_listing_start(self, subscription: DataPackageBody)

This override is called when a full listing starts.

def on_full_listing_stop(self, is_aborted: bool, exception: Optional[Exception]) ‑> None

This override is called when the full listing is stopped. Parameters


is_aborted : bool
The processing was aborted.
exception : Optional[Exception]
If not None, there was an exception.
def on_incremental_items(self, subscription: DataPackageBody, items: List[ForwardRef('DataPackageListItem')])

This override is called repeatedly with one or more items until all updated items are listed.

def on_incremental_start(self, subscription: DataPackageBody)

This override is called when an incremental listing starts.

def on_incremental_stop(self, is_aborted: bool, exception: Optional[Exception]) ‑> None

This override is called when the incremental listing is stopped. Parameters


is_aborted : bool
The processing was aborted.
exception : Optional[Exception]
If not None, there was an exception.
def start(self) ‑> None

Start processing. It will continue to run until abort is called.