Registry / communication / pypd
library1.1.0pypiunverified

pypd is a community-supported Python client for PagerDuty's v2 API, allowing developers to interact with PagerDuty services. It provides an interface for common API operations. The latest version is 1.1.0, released in March 2018, indicating a low release cadence.

pip install pypd
INSTALL
IMPORT
SIG · PYPD
P
pypd
communicationenv1.1.0
Install
3.0s avg
Import
608ms
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.634s · 23.1MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 3.0s · import 0.581s · 24MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pypd
✓ import pypd
The primary import for accessing the client and its methods.

This quickstart demonstrates how to initialize the pypd client using environment variables for authentication and then fetch a PagerDuty incident by its ID. It highlights the recommended practice of configuring API keys securely via environment variables.

import pypd import os # Configure API key either directly or from environment variables # It's recommended to use environment variables for security. # export PD_API_KEY='YOUR_PAGERDUTY_API_KEY' # export PD_API_URL='https://api.pagerduty.com' # Option 1: Set directly (less secure for production) # pypd.api_key = os.environ.get('PD_API_KEY', 'YOUR_PAGERDUTY_API_KEY') # pypd.api_url = os.environ.get('PD_API_URL', 'https://api.pagerduty.com') # Option 2: Initialize from environment variables (recommended) pypd.from_env() # Example: Fetch an incident by ID try: # Replace 'YOUR_INCIDENT_ID' with an actual incident ID incident_id = os.environ.get('PAGERDUTY_TEST_INCIDENT_ID', 'YOUR_INCIDENT_ID') if incident_id == 'YOUR_INCIDENT_ID': print("Please set PAGERDUTY_TEST_INCIDENT_ID environment variable or replace 'YOUR_INCIDENT_ID' in code.") else: incident = pypd.Incident.fetch(id=incident_id) print(f"Fetched incident: {incident['title']} (ID: {incident['id']})") # Example: Print a few details print(f"Status: {incident['status']}") print(f"Urgency: {incident['urgency']}") except Exception as e: print(f"Error fetching incident: {e}") print("Ensure PD_API_KEY and PD_API_URL are set correctly and the incident ID is valid.")
Debug
Known issues
breakingThe 'pypd' library is community-supported and has not been updated since March 2018. For new projects, PagerDuty itself recommends using the more actively maintained `python-pagerduty` library, which is a successor to other PagerDuty Python clients like `pdpyras`.
fix
Consider migrating to `python-pagerduty` for new development or if active maintenance and new features are required. The migration path from `pypd` may require code changes due to different API client design.
affects: <=1.1.0
gotchaAuthentication requires a PagerDuty API token (v2) and potentially an API URL. It is crucial to handle these credentials securely, ideally through environment variables (e.g., `PD_API_KEY`, `PD_API_URL`) rather than hardcoding them.
fix
Store `PD_API_KEY` and `PD_API_URL` as environment variables and use `pypd.from_env()` for initialization. Never hardcode sensitive API keys directly in your source code.
affects: All
gotchaThe library name 'pypd' can easily be confused with 'pypdf' or 'PyPDF2', which are popular Python libraries for PDF file manipulation. Ensure you are installing and importing the correct library for PagerDuty API interactions.
fix
Double-check `pip install pypd` and import statements (`import pypd`) to confirm you are using the PagerDuty client, and not inadvertently pulling in a PDF library.
affects: All
Upgrade
Version history
1.1.0latest on PyPI · released Mar 26, 2018
Audit
Dependencies
requestsrequiredUsed as the underlying HTTP client library for making API calls.
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
pypd — pip install pypd · libregistry