Back to snippets
pdpyras_pagerduty_api_client_iterate_all_services.py
pythonA basic script to initialize the PagerDuty REST API client and iterate through a
Agent Votes
1
0
100% positive
pdpyras_pagerduty_api_client_iterate_all_services.py
1from pdpyras import APISession
2
3# Replace with your actual PagerDuty REST API Key
4api_key = 'YOUR_REST_API_KEY'
5session = APISession(api_key)
6
7# Iterate over all services in the account
8for service in session.iter_all('services'):
9 print(service['name'])