pytest-httpbin
Easily test your HTTP library against a local copy of httpbin
What it is and what it does
pytest-httpbin is a pytest plugin that injects a fixture providing a local HTTP server running httpbin—a service designed to test HTTP client libraries. Instead of making test requests to a remote httpbin.org service, your tests run against a server started in a separate thread on your machine, eliminating network latency and external dependencies.
You use it by accepting the httpbin fixture in your test function and accessing its URL property to make requests. The package supports both HTTP and HTTPS (with its own CA certificate included), and integrates seamlessly with pytest's fixture injection model. It's built on httpbin, which provides endpoints for testing GET, POST, headers, redirects, status codes, and other HTTP behaviors.
Use it for:
- Test HTTP client code without relying on external services or network connectivity.
- Verify your application's HTTP request handling against a predictable local server.
- Run fast, isolated test suites that don't depend on httpbin.org availability.
- Test HTTPS endpoints and certificate handling using the included CA certificate.
- Develop and validate HTTP client libraries in CI/CD pipelines without network calls.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a pytest fixture that runs a local httpbin server in a test thread, eliminating the need for remote HTTP service calls during testing.
Yes. This is a stable, actively maintained testing utility with minimal dependencies and no known vulnerabilities. If you test HTTP client code and want to avoid remote service calls, it directly solves that problem with a clean pytest integration. The low install friction and permissive license make adoption straightforward.
Install
pytest-httpbin on PyPI
pip
pip install pytest-httpbinuv
uv add pytest-httpbinpoetry
poetry add pytest-httpbinInstalling pytest-httpbin
Before you install
Low friction install with a single runtime dependency (httpbin). Actively maintained with recent commits and stable production status across Python 3.8–3.11.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
Quickstart
pip install pytest-httpbin
# In your test file:
def test_http_get(httpbin):
response = httpbin.url + '/get'
assert response is not None
Verify before relying
- Whether the included CA certificate works with standard HTTPS validation workflows without additional configuration.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — httpbin |
| Maintenance | actively maintained — 695 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 157,747/month — #10,746 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_httpbin-2.1.0-py3-none-any.whl
Keywords: pytest-httpbin, testing, pytest, httpbin
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
httpbinhttpbin is a Flask-based HTTP request and…
permissive · top 15,000 on PyPI
pytest-localserverProvides pytest fixtures that spin up local…
permissive · top 15,000 on PyPI
pytest-base-urlA pytest plugin that injects a configurable…
copyleft · top 5,000 on PyPI
pytest-httpxpytest-httpx provides a pytest fixture that…
permissive · top 1,000 on PyPI
pytest-recordingA pytest plugin that records and replays HTTP…
permissive · top 5,000 on PyPI
pytest_httpserverA pytest fixture and standalone context manager…
unclear · top 5,000 on PyPI
pytest-localftpserverProvides pytest fixtures for running local FTP…
permissive · top 15,000 on PyPI
pytest-fakerProvides pytest fixtures that integrate the…
permissive · top 15,000 on PyPI
pytest-sftpserverA pytest plugin that provides a fixture for…
permissive · top 5,000 on PyPI
pytest-responsesAutomatically mocks HTTP requests across your…
permissive · top 15,000 on PyPI