responses

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

Library
PyPI
v0.26.2
4,344stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
77/100Good
Development Activity64
Maintenance64
Community80
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
85/100Excellent
Architecture82
Code Quality88
Innovation80
Learning Curve90

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
49%
Other

Airbyte

Developer Tools · Data Engineering

21,916

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
Python49%
Kotlin42%
Updated today
Python
51%
MIT

Docs

File Storage · CMS

16,733

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
87
Repo Health
81
Technical
72
Dependency
Built with
Python51%
TypeScript42%
Updated 2 days ago
Python
64%
BSD 3

Flagsmith

Developer Tools · Devops · Ab Testing Experimentation

6,518

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
91
Repo Health
82
Technical
65
Dependency
Built with
Python64%
TypeScript31%
Updated today
HTML
48%
LGPL-2.1

Horilla

Human Resources · ERP

1,330

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

View details
88
Repo Health
60
Technical
65
Dependency
Built with
HTML48%
Python35%
JavaScript13%
Updated today
Python
63%
Other

Keep

Devops · Automation · Monitoring

12,224

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
91
Repo Health
79
Technical
67
Dependency
Built with
Python63%
TypeScript36%
Updated today
TypeScript
38%
Apache 2.0

Label Studio

AI Development · Data Engineering

28,083

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
68
Dependency
Built with
TypeScript38%
JavaScript27%
Python25%
Updated today
Python
99%
Apache 2.0

Rasa Open Source

AI Assistants · AI Development

21,295

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
67
Repo Health
78
Technical
64
Dependency
Built with
Python99%
Updated 3 weeks 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

Search