respx
A utility for mocking out the Python HTTPX and HTTP Core libraries.
Decision gist · record as of 2026-08-14
Yes. RESPX is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a common testing need cleanly. If you use HTTPX in your codebase and write tests, this is a standard choice for mocking HTTP calls. The permissive BSD-3-Clause license poses no adoption barrier.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction install with a single runtime dependency (httpx).
- Actively maintained with recent commits; last release 128 days ago.
- Supports Python 3.8 through 3.14.
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause (permissive) — you can use, modify, and distribute freely in commercial or private projects with minimal restrictions.
last release 2026-04-08 (128 days) · last repo commit 2026-07-21 · 828 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 22,221,967 downloads/mo, #982 on PyPI
Alternatives
Verify before relying
pip install respx
import httpx
import respx
from httpx import Response
@respx.mock
def test_example():
respx.get("https://example.org/").mock(return_value=Response(204))
response = httpx.get("https://example.org/")
assert response.status_code == 204- Whether HTTP Core mocking works identically to HTTPX mocking or has different coverage.
- Performance characteristics when mocking large numbers of routes or high-frequency requests.
- Specific HTTPX version compatibility beyond the stated 0.25+ requirement.
What it is and what it does
RESPX is a mocking utility for testing code that uses HTTPX or HTTP Core. It intercepts HTTP requests during tests and returns predefined responses based on request patterns you define, eliminating the need to hit real endpoints or manage test fixtures. You patch HTTPX with a decorator or pytest fixture, then register routes with mock responses; when your code makes a matching request, RESPX returns your canned response instead. It supports both sync and async code, works with pytest, and lets you assert on whether routes were called.
The package is lightweight—it depends only on httpx—and integrates cleanly into test suites. It handles request pattern matching and response side effects, making it suitable for unit tests, integration tests, and scenarios where you need fine-grained control over HTTP behavior without external services.
Use it for
- Unit test code that calls external APIs without making real network requests.
- Test error handling by mocking HTTP error responses and edge cases.
- Verify your code sends correct headers, query parameters, or request bodies to an endpoint.
- Mock async HTTPX calls in pytest tests using the respx_mock fixture.
- Simulate rate-limiting, timeouts, or other HTTP side effects during testing.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
RESPX is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a common testing need cleanly. If you use HTTPX in your codebase and write tests, this is a standard choice for mocking HTTP calls. The permissive BSD-3-Clause license poses no adoption barrier.
Install
respx on PyPI
Before you install
Low friction install with a single runtime dependency (httpx). Actively maintained with recent commits; last release 128 days ago. Supports Python 3.8 through 3.14.
License in practice
BSD-3-Clause (permissive) — you can use, modify, and distribute freely in commercial or private projects with minimal restrictions.
Quickstart
pip install respx
import httpx
import respx
from httpx import Response
@respx.mock
def test_example():
respx.get("https://example.org/").mock(return_value=Response(204))
response = httpx.get("https://example.org/")
assert response.status_code == 204
Verify before relying
- Whether HTTP Core mocking works identically to HTTPX mocking or has different coverage.
- Performance characteristics when mocking large numbers of routes or high-frequency requests.
- Specific HTTPX version compatibility beyond the stated 0.25+ requirement.
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagehttpx |
| Maintenance | Actively maintained 128 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 22,221,967 / month, #982 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating 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.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: respx-0.23.1-py2.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 › “httpx testing library”
- respxRESPX mocks HTTPX and HTTP Core libraries for testing, letting you…
- httpx-wsAdds WebSocket support to HTTPX, enabling sync and async WebSocket…
- pytest-httpxpytest-httpx provides a pytest fixture that intercepts httpx requests…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also pytest-httpx · pytest-httpx2 · smithy-http · pook · urllib3-mock · pytest-responses · aioresponses · aiointercept · httmock · curlify2