Module betterstack.uptime.objects

This module will house all derrivatives of BaseAPIObject. These are used to configure specific API enpoints, and their custom behaviour

Module contents

class betterstack.uptime.objects.Monitor(api: RESTAPI, id: int, attributes: dict = None, **kwargs)[source]

Bases: BaseAPIObject

Subclass in order to differentiate between endpoints and types. Can be used to store custom functionality

Initializes the object with a corresponding API client, id and optional attributes If only the ID is provided, it will fetch data from the API in order to fill it’s attributes. If attributes are provided, just assign them

Parameters:
  • api (RESTAPI) – API Instance

  • id (int) – Object ID to get (optional)

  • attributes (dict) – Attributes to assign to class. Use only attributes fetched from API here!

type = 'monitor'
__init__(api: RESTAPI, id: int, attributes: dict = None, **kwargs)[source]

Initializes the object with a corresponding API client, id and optional attributes If only the ID is provided, it will fetch data from the API in order to fill it’s attributes. If attributes are provided, just assign them

Parameters:
  • api (RESTAPI) – API Instance

  • id (int) – Object ID to get (optional)

  • attributes (dict) – Attributes to assign to class. Use only attributes fetched from API here!

class betterstack.uptime.objects.MonitorSLA(api: RESTAPI, id: int, sla_from=None, sla_to=None, attributes: dict = None, force_update=False)[source]

Bases: BaseAPIObject

Subclass in order to differentiate between endpoints and types. Can be used to store custom functionality

Initializes the object with a corresponding API client, id and optional attributes If only the ID is provided, it will fetch data from the API in order to fill it’s attributes. If attributes are provided, just assign them

Parameters:
  • api (RESTAPI) – API Instance

  • id (int) – Object ID to get (optional)

  • attributes (dict) – Attributes to assign to class. Use only attributes fetched from API here!

type = 'monitor_sla'
__init__(api: RESTAPI, id: int, sla_from=None, sla_to=None, attributes: dict = None, force_update=False)[source]

Initializes the object with a corresponding API client, id and optional attributes If only the ID is provided, it will fetch data from the API in order to fill it’s attributes. If attributes are provided, just assign them

Parameters:
  • api (RESTAPI) – API Instance

  • id (int) – Object ID to get (optional)

  • attributes (dict) – Attributes to assign to class. Use only attributes fetched from API here!

property timeframe
generate_url()[source]

Creates the URL in order to get this specific instance

Returns:

Full instance URL

Return type:

str

classmethod generate_global_url()[source]

Get the overview page for this object type

Returns:

Overview page for object

Return type:

str

class betterstack.uptime.objects.MonitorGroup(api: RESTAPI, id: int, attributes: dict = None)[source]

Bases: BaseAPIObject

Subclass in order to differentiate between endpoints and types. Can be used to store custom functionality

Initializes the object with a corresponding API client, id and optional attributes If only the ID is provided, it will fetch data from the API in order to fill it’s attributes. If attributes are provided, just assign them

Parameters:
  • api (RESTAPI) – API Instance

  • id (int) – Object ID to get (optional)

  • attributes (dict) – Attributes to assign to class. Use only attributes fetched from API here!

type = 'monitor_group'
__init__(api: RESTAPI, id: int, attributes: dict = None)[source]

Initializes the object with a corresponding API client, id and optional attributes If only the ID is provided, it will fetch data from the API in order to fill it’s attributes. If attributes are provided, just assign them

Parameters:
  • api (RESTAPI) – API Instance

  • id (int) – Object ID to get (optional)

  • attributes (dict) – Attributes to assign to class. Use only attributes fetched from API here!

fetch_monitors()[source]
class betterstack.uptime.objects.Heartbeat(api: RESTAPI, id: int = None, attributes: dict = None, **kwargs)[source]

Bases: BaseAPIObject

Subclass in order to differentiate between endpoints and types. Can be used to store custom functionality

Initializes the object with a corresponding API client, id and optional attributes If only the ID is provided, it will fetch data from the API in order to fill it’s attributes. If attributes are provided, just assign them

Parameters:
  • api (RESTAPI) – API Instance

  • id (int) – Object ID to get (optional)

  • attributes (dict) – Attributes to assign to class. Use only attributes fetched from API here!

type = 'heartbeat'
class betterstack.uptime.objects.HeartbeatGroup(api: RESTAPI, id: int = None, attributes: dict = None, **kwargs)[source]

Bases: BaseAPIObject

Subclass in order to differentiate between endpoints and types. Can be used to store custom functionality

Initializes the object with a corresponding API client, id and optional attributes If only the ID is provided, it will fetch data from the API in order to fill it’s attributes. If attributes are provided, just assign them

Parameters:
  • api (RESTAPI) – API Instance

  • id (int) – Object ID to get (optional)

  • attributes (dict) – Attributes to assign to class. Use only attributes fetched from API here!

type = 'heartbeat-group'
class betterstack.uptime.objects.Incident(api: RESTAPI, id: int = None, attributes: dict = None, **kwargs)[source]

Bases: BaseAPIObject

Subclass in order to differentiate between endpoints and types. Can be used to store custom functionality

Initializes the object with a corresponding API client, id and optional attributes If only the ID is provided, it will fetch data from the API in order to fill it’s attributes. If attributes are provided, just assign them

Parameters:
  • api (RESTAPI) – API Instance

  • id (int) – Object ID to get (optional)

  • attributes (dict) – Attributes to assign to class. Use only attributes fetched from API here!

type = 'incident'