{"id":5695,"library":"pygerduty","title":"Pygerduty Python Client for PagerDuty","description":"Pygerduty is a Python client library for interacting with PagerDuty's REST API and Events API. Originally designed for PagerDuty API v1, it includes some updates for v2 compatibility in a separate module. The latest version is 0.38.3, released in April 2020.","status":"deprecated","version":"0.38.3","language":"en","source_language":"en","source_url":"https://github.com/dropbox/pygerduty","tags":["PagerDuty","API Client","Incident Management","DevOps"],"install":[{"cmd":"pip install pygerduty","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"HTTP client for API communication.","package":"requests","optional":false},{"reason":"Required for Python versions < 2.6 (e.g., Python 2.5).","package":"simplejson","optional":true}],"imports":[{"note":"The PagerDuty class is typically accessed via the top-level package namespace after a simple import.","wrong":"from pygerduty import PagerDuty","symbol":"PagerDuty","correct":"import pygerduty\npager = pygerduty.PagerDuty(\"your_subdomain\", \"your_api_key\")"},{"note":"For PagerDuty API v2 interactions, the client is exposed through the `v2` submodule.","symbol":"PagerDuty (V2 API)","correct":"import pygerduty.v2\npager_v2 = pygerduty.v2.PagerDuty(\"your_subdomain\", \"your_api_key\")"}],"quickstart":{"code":"import os\nimport pygerduty\n\n# Ensure your PagerDuty subdomain and API key are set as environment variables\nPD_SUBDOMAIN = os.environ.get('PD_SUBDOMAIN', 'your_subdomain_here')\nPD_API_KEY = os.environ.get('PD_API_KEY', 'YOUR_API_KEY_HERE')\n\nif not PD_SUBDOMAIN or not PD_API_KEY:\n    print(\"Please set PD_SUBDOMAIN and PD_API_KEY environment variables.\")\nelse:\n    try:\n        # Instantiate a PagerDuty client (targets v1 API by default)\n        pager = pygerduty.PagerDuty(PD_SUBDOMAIN, PD_API_KEY)\n\n        # List schedules (example using v1 API pattern)\n        print(f\"Fetching schedules for subdomain: {PD_SUBDOMAIN}\")\n        for schedule in pager.schedules.list():\n            print(f\"  - ID: {schedule.id}, Name: {schedule.name}\")\n\n        # For PagerDuty API v2 interactions (if implemented in your version/fork)\n        # import pygerduty.v2\n        # pager_v2 = pygerduty.v2.PagerDuty(PD_SUBDOMAIN, PD_API_KEY)\n        # print(\"\\nFetching users via v2 API (if supported by your client config):\")\n        # for user in pager_v2.users.list():\n        #     print(f\"  - ID: {user.id}, Name: {user.name}, Email: {user.email}\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n        print(\"Please check your PagerDuty subdomain, API key, and network connectivity.\")","lang":"python","description":"This quickstart demonstrates how to instantiate a `pygerduty` client for the PagerDuty v1 API (default behavior) and fetch a list of schedules. It uses environment variables for authentication credentials."},"warnings":[{"fix":"Consider migrating to an actively maintained PagerDuty Python client that fully supports API v2, such as `python-pagerduty` (official PagerDuty library) or `pypd`.","message":"The PagerDuty API v1, which `pygerduty` primarily targets, was officially deprecated by PagerDuty in July 2017 and is no longer supported. The library's `v2` submodule (introduced later) might provide limited v2 compatibility, but the library is largely unmaintained for modern PagerDuty API usage.","severity":"breaking","affected_versions":"<= 0.38.3"},{"fix":"No direct fix for this library. Users should transition to alternative, actively maintained PagerDuty Python clients for new development and ongoing support.","message":"The library lacks recent maintenance. The last PyPI release was in April 2020, and the GitHub repository shows no significant activity since then. It is effectively unmaintained.","severity":"deprecated","affected_versions":"All versions"},{"fix":"Ensure your environment uses Python 3.6 or newer. If you must interact with legacy PagerDuty API v1 endpoints and this specific library, be aware of potential compatibility issues with very recent Python 3 versions due to lack of updates.","message":"Python 2 support is no longer relevant as Python 2 reached end-of-life. While older versions of `pygerduty` claimed Python 2.5+ compatibility, modern Python applications should use Python 3.6+.","severity":"breaking","affected_versions":"<= 0.38.3 (regarding Python 2 compatibility)"},{"fix":"Always provide the correct subdomain and API key. When using PagerDuty API v2 (if using `pygerduty.v2`), ensure you understand the requirements for the `From` header and API key types as per PagerDuty's official API documentation.","message":"Authentication for the PagerDuty API requires both a subdomain (e.g., 'yourcompany' from 'yourcompany.pagerduty.com') and an API key. For PagerDuty API v2, the `From` header (an email address of a PagerDuty user) is often required for certain actions if an account-level API key is used.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}