- PagerDuty /
- Engineering Blog /
- Introducing Our New Thread-safe API Client for Python
Engineering Blog
Introducing Our New Thread-safe API Client for Python
Our official API client for Python has come a long way. It began in July 2018 as pdpyras (for PagerDuty Python REST API Sessions) out of necessity for a standard Python implementation of classic pagination, token authentication, user/service querying, and connection pooling. Early in 2025, from the source code of pdpyras, python-pagerduty was created. Since then, it has grown in features and support for new APIs, but it has also transformed from the original single-file monolith into a far more maintainable and mature project codebase.
Today, we are are pleased to announce a fundamental change in its design that has remained constant since its beginning: we have switched the HTTP client on which it is based from python-requests to python-httpx. Requests: HTTP for Humans™ is a popular and easy-to-use HTTP client library, and since 2018 it has served as a reliable foundation on which to build PagerDuty’s top API client for Python. However, its greatest limitation has long been its lack of thread safety. To meet the long-running demand of our userbase for thread safety, we therefore are switching to use HTTPX: A next-generation HTTP client for Python as our base HTTP client. In addition to making the API client thread safe, this change also enables potential future support for async API requests.
Version 6.0.0 of python-pagerduty introduces this fundamental change. While this update does include a few breaking changes, most notably how the client would be configured to use a proxy server, the developer interface of python-httpx is very similar to that of python-requests and we believe the transition will mostly be an easy one. If you run into any challenges or errors in the adoption of the new and improved python-pagerduty, please let us know by submitting a GitHub issue.