responses

A utility library for mocking out the Python requests library in your test suite.

Library
PyPI
v0.26.3
4,342 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
82 /100 Excellent
Development Activity 80
Maintenance 68
Community 80
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
85 /100 Excellent
Architecture 82
Code Quality 88
Innovation 80
Learning Curve 90

Responses is a Python testing utility that intercepts calls made through the popular requests HTTP library and returns pre-registered mock responses instead of hitting real servers. It mirrors the requests API closely, so registering a fake endpoint feels familiar and requires almost no boilerplate.

Maintained by Sentry, responses lets you assert exactly which requests your code makes, match against bodies, query strings, and headers, and drive tests deterministically without a live network. It ships with type hints, a rich set of request matchers, and a recorder that can capture real traffic into reusable fixtures.

What You Get

  • A @responses.activate decorator and RequestsMock context manager that intercept all requests traffic within their scope
  • Shortcut helpers (responses.get, responses.post, etc.) and a Response object for registering mocked endpoints
  • A comprehensive matchers module for asserting on JSON bodies, URL-encoded data, query params, headers, and request kwargs
  • A recorder that captures real HTTP traffic into reusable YAML fixtures
  • Built-in assertions that every registered response was fired and that unexpected calls raise ConnectionError

Common Use Cases

  • Unit-testing code that calls external HTTP APIs without a live network connection
  • Asserting that your client sends the correct method, URL, body, and headers
  • Simulating error responses, timeouts, and exceptions to exercise failure paths
  • Recording real API responses once and replaying them as deterministic fixtures

Under The Hood

Architecture - The core lives in responses/__init__.py, where a RequestsMock object holds a registry of registered responses and patches requests’ underlying HTTPAdapter.send (via unbound_on_send) so outgoing calls are matched against registered mocks rather than dispatched to the network. The activate decorator and context-manager protocol simply enter and exit this patched state, and registries.py provides pluggable ordering strategies (FIFO vs first-match) for how registered responses are selected.

Tech Stack - Pure Python (3.8+) with a small dependency surface: requests>=2.30, urllib3, and pyyaml for the recorder’s fixture format. Packaging is via setuptools/setup.py, typing is shipped through py.typed, and quality tooling includes mypy (mypy.ini), flake8, tox for multi-version matrices, and pytest with coverage.

Code Quality - The repo has an extensive responses/tests suite exercised across Python versions via tox, strict mypy typing, and a dedicated matchers.py module keeping request-matching logic isolated and unit-testable. A _recorder.py module cleanly separates the record-and-replay concern from the mocking core.

API Design - The public surface deliberately mirrors requests (responses.get, responses.post, Response(...)), which flattens the learning curve to near zero for anyone who already uses requests. Matchers compose as an iterable passed to match=, and clear deprecation tables in the README guide migration, making the ergonomics excellent.

Used by 7 apps in this directory

Python
47%
Other

Airbyte

Data Engineering · Developer Tools

22,143

Open-source ELT platform with 600+ connectors for moving data from any source to warehouses, lakes, and AI agents.

View details
95
Repo Health
80
Technical
67
Dependency
Built with
Python 47%
Kotlin 43%
Updated 4 days ago
Python
47%
MIT

Docs

CMS · File Storage

16,868

Open-source collaborative knowledge platform with real-time editing, AI writing tools, and full self-hosting control — built by the French and German governments.

View details
88
Repo Health
81
Technical
68
Dependency
Built with
Python 47%
TypeScript 45%
Updated 4 days ago
Python
63%
BSD 3

Flagsmith

Ab Testing Experimentation · Developer Tools · Devops

6,577

Open-source feature flagging, remote config, and A/B/multivariate testing platform for web, mobile, and server-side apps — self-host or use the hosted SaaS.

View details
90
Repo Health
82
Technical
63
Dependency
Built with
Python 63%
TypeScript 31%
Updated 6 days ago
HTML
46%
LGPL-2.1

Horilla

ERP · Human Resources

1,437

Open-source HRMS covering recruitment, attendance, payroll, and biometrics in one self-hosted Django application.

View details
91
Repo Health
60
Technical
65
Dependency
Built with
HTML 46%
Python 38%
JavaScript 12%
Updated 4 days ago
Python
64%
Other

Keep

Automation · Devops · Monitoring

12,359

The open-source AIOps and alert management platform that unifies 130+ monitoring tools into a single pane of glass with AI-powered correlation, deduplication, and workflow automation.

View details
89
Repo Health
79
Technical
66
Dependency
Built with
Python 64%
TypeScript 36%
Updated 1 weeks ago
TypeScript
39%
Apache 2.0

Label Studio

AI Development · Data Engineering

28,358

Label Studio is an open-source, multi-type data labeling platform that lets teams annotate images, text, audio, video, and time series data with a configurable XML-based UI and export annotations in formats ready for any ML framework.

View details
93
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 39%
JavaScript 27%
Python 25%
Updated 4 days ago
Python
99%
Apache 2.0

Rasa Open Source

AI Assistants · AI Development · Voice AI

21,332

Rasa Open Source is a Python machine learning framework for building contextual, multi-turn chatbots and voice assistants that understand natural language and maintain conversation state.

View details
64
Repo Health
78
Technical
63
Dependency
Built with
Python 99%
Updated 2 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers