HTTPretty vs responses
Python HTTP testing libraries compared
HTTPretty and responses replace real HTTP responses with fakes so Python tests can exercise HTTP-dependent code without relying on live services. HTTPretty intercepts traffic at the socket level, while responses targets calls made with the `requests` library and offers detailed request matching and response management.

HTTPretty: Mock HTTP Requests in Python Tests
HTTPretty intercepts Python HTTP traffic at the socket level and returns registered fake responses. It helps developers test API integrations without relying on live services, and can capture requests for assertions or playback.

responses: Mock Python Requests in Tests
Responses intercepts Python Requests calls and serves registered mock responses, so tests can exercise HTTP client code without contacting real services. It supports request matching, callbacks, call assertions, and ordered response sequences.
| HTTPretty | responses | |
|---|---|---|
| Language | Python | Python |
| License | MIT | Apache-2.0 |
| Stars | 2.1k | 4.3k |
| Forks | 285 | 386 |
| Last analyzed | Oct 3, 2026 | Oct 3, 2026 |
Key differences
- HTTPretty intercepts Python HTTP traffic at the socket level; responses intercepts calls made with `requests`.
- HTTPretty can capture requests for body and count inspection; responses records calls and supports assertions about call counts.
- responses offers matchers for request data and headers, callbacks, passthrough rules, and beta response recording and replay; HTTPretty lists registered fakes, repeated responses, and disabling network connections.
- HTTPretty lists Python 3.6 through 3.9 as supported; responses requires Python 3.8 or newer and `requests` 2.30.0 or newer, according to their READMEs.
- HTTPretty uses the MIT license; responses uses Apache-2.0.
- HTTPretty has 2.1k stars and 285 forks; responses has 4.3k stars and 386 forks.
Choose HTTPretty if you…
- need socket-level interception for Python HTTP traffic.
- want to test code using HTTP clients beyond `requests`.
- need to inspect captured request bodies or test multiple responses to the same URL.
Choose responses if you…
- use `requests` and want to match request data, headers, or selected arguments.
- need callbacks or ordered response sequences to model changing server behavior.
- want to inspect recorded calls, configure passthrough rules, or try beta response recording and replay.
Compare the numbers side by side, or add more projects
This comparison is generated with AI from the OSRepos analyses of both projects. Always check each project's repository and documentation before choosing.