The EventHistory resource can be used fetch historic event data for a device. This can be achieved by using the API Method included in the class.

All the fetched historic events are returned to the user in a list.

API Methods

disruptive.EventHistory.list_events(device_id, project_id, event_types=None, start_time=None, end_time=None, **kwargs)

Get the event history for a single device.

  • device_id (str) – Unique ID of the target device.

  • project_id (str) – Unique ID of the target project.

  • event_types (list[str], optional) – If provided, only the specified event types are fetched.

  • start_time (str, datetime, optional) – Specifies from when event history is fetched. Defaults to 24 hours ago.

  • end_time (str, datetime, optional) – Specified until when event history is fetched. Defaults to now.

  • **kwargs – Arbitrary keyword arguments. See the Configuration page.


events – A list of all events fetched by the call.

Return type:



>>> # Fetch all historic events the last 24 hours.
>>> events = disruptive.EventHistory.list_events(
...     device_id='<DEVICE_ID>',
...     project_id='<PROJECT_ID',
... )
>>> # Create a datetime object for 7 days ago.
>>> from datetime import datetime, timedelta
>>> seven_days_ago = datetime.now() - timedelta(7)
>>> # Fetch objectPresent event history the last 7 days.
... events = dt.EventHistory.list_events(
...     device_id='<DEVICE_ID>',
...     project_id='<PROJECT_ID>',
...     event_types=['objectPresent'],
...     start_time=seven_days_ago,
... )