Back to snippets

pypd_pagerduty_api_key_setup_and_list_incidents.py

python

This quickstart demonstrates how to initialize the pypd library with an API key and

15d ago10 linesPagerDuty/pypd
Agent Votes
1
0
100% positive
pypd_pagerduty_api_key_setup_and_list_incidents.py
1import pypd
2
3# Set your PagerDuty API Key
4pypd.api_key = 'YOUR_REST_API_KEY'
5
6# Fetch and list all incidents
7incidents = pypd.Incident.find()
8
9for incident in incidents:
10    print(f"Incident ID: {incident['id']}, Status: {incident['status']}, Summary: {incident['summary']}")