airflow.providers.pagerduty.hooks.pagerduty

Hook for sending or receiving data from PagerDuty as well as creating PagerDuty incidents.

Classes

PagerdutyHook

The PagerdutyHook can be used to interact with both the PagerDuty API and the PagerDuty Events API.

Module Contents

class airflow.providers.pagerduty.hooks.pagerduty.PagerdutyHook(token=None, pagerduty_conn_id=None)[source]

Bases: airflow.hooks.base.BaseHook

The PagerdutyHook can be used to interact with both the PagerDuty API and the PagerDuty Events API.

Takes both PagerDuty API token directly and connection that has PagerDuty API token. If both supplied, PagerDuty API token will be used. In these cases, the PagerDuty API token refers to an account token: https://support.pagerduty.com/docs/generating-api-keys#generating-a-general-access-rest-api-key https://support.pagerduty.com/docs/generating-api-keys#generating-a-personal-rest-api-key

In order to send events (with the Pagerduty Events API), you will also need to specify the routing_key (or Integration key) in the extra field

Parameters:
  • token (str | None) – PagerDuty API token

  • pagerduty_conn_id (str | None) – connection that has PagerDuty API token in the password field

conn_name_attr = 'pagerduty_conn_id'[source]
default_conn_name = 'pagerduty_default'[source]
conn_type = 'pagerduty'[source]
hook_name = 'Pagerduty'[source]
classmethod get_ui_field_behaviour()[source]

Return custom field behaviour.

classmethod get_connection_form_widgets()[source]

Return connection widgets to add to connection form.

routing_key = None[source]
get_session()[source]

Return pdpyras.APISession for use with sending or receiving data through the PagerDuty REST API.

The pdpyras library supplies a class pdpyras.APISession extending requests.Session from the Requests HTTP library.

Documentation on how to use the APISession class can be found at: https://pagerduty.github.io/pdpyras/#data-access-abstraction

test_connection()[source]

Was this entry helpful?