responses
A utility library for mocking out the `requests` Python library.
Decision gist · record as of 2026-08-14
Yes. Responses is a mature, actively maintained testing utility with no security vulnerabilities, low install friction, and permissive licensing. It's a standard choice for testing code that uses requests, and its decorator and context-manager interfaces integrate cleanly into existing test suites. Install it if you write tests for code that makes HTTP calls.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires requests >= 2.30.0 and Python 3.8 or newer.
- Low friction install with no compiled dependencies.
- Actively maintained as of 2026-07-03, with recent activity and 4344 repository stars.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows use in commercial and private projects with minimal restrictions.
last release 2026-07-03 (42 days) · last repo commit 2026-07-24 · 4,344 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 71,526,828 downloads/mo, #464 on PyPI
Alternatives
Verify before relying
pip install responses
import responses
import requests
@responses.activate
def test_api():
responses.get('http://example.com/api', json={'key': 'value'})
resp = requests.get('http://example.com/api')
assert resp.json() == {'key': 'value'}- Whether the package supports async/await patterns or only synchronous requests mocking.
- Performance characteristics when mocking a large number of endpoints in a single test.
What it is and what it does
Responses is a mocking library that intercepts calls made by the requests library, allowing you to define mock responses for specific URLs and HTTP methods without making real network calls. It works by registering expected responses before your test runs, then raising a ConnectionError if your code tries to hit an unmocked URL—ensuring your tests only exercise the paths you've explicitly defined.
You can register mocks using a decorator, context manager, or direct API calls, and match requests based on method, URL, query parameters, request body, headers, and other attributes. The library includes built-in matchers for JSON and URL-encoded bodies, and supports custom matchers for more complex scenarios. It's designed for unit testing code that depends on external HTTP services, letting you verify your code's behavior without network access or external service availability.
Use it for
- Unit test code that calls third-party REST APIs without requiring network access or API credentials.
- Verify your application sends the correct HTTP method, headers, and body to an external service.
- Test error handling by mocking different HTTP status codes and error responses.
- Isolate tests from external service outages or rate limits by replacing real calls with deterministic mocks.
- Test multiple code paths by registering different responses for the same URL based on request attributes.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Responses is a mature, actively maintained testing utility with no security vulnerabilities, low install friction, and permissive licensing. It's a standard choice for testing code that uses requests, and its decorator and context-manager interfaces integrate cleanly into existing test suites. Install it if you write tests for code that makes HTTP calls.
Install
responses on PyPI
Before you install
Low friction install with no compiled dependencies. Actively maintained as of 2026-07-03, with recent activity and 4344 repository stars. Requires requests >= 2.30.0 and Python 3.8 or newer.
Requires requests >= 2.30.0 and Python 3.8 or newer.
License in practice
Apache-2.0 permissive license allows use in commercial and private projects with minimal restrictions.
Quickstart
pip install responses
import responses
import requests
@responses.activate
def test_api():
responses.get('http://example.com/api', json={'key': 'value'})
resp = requests.get('http://example.com/api')
assert resp.json() == {'key': 'value'}
Verify before relying
- Whether the package supports async/await patterns or only synchronous requests mocking.
- Performance characteristics when mocking a large number of endpoints in a single test.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesrequestsurllib3pyyaml |
| Maintenance | Actively maintained 42 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 71,526,828 / month, #464 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersIntended Audience :: System AdministratorsOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development |
Evidence: responses-0.26.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “test api calls without network”
- responsesMocks HTTP requests made by the requests library, allowing you to…
- httmockIntercepts and mocks HTTP requests made by the requests library,…
- betamaxBetamax records and replays HTTP interactions made through the…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also pytest-responses · requests-mock · urllib3-mock · pook · httmock · aioresponses · mocket · aresponses · aiointercept · pytest_httpserver