betamax
A VCR imitation for python-requests
What it is and what it does
Betamax is a VCR-style HTTP interaction recorder and replayer for the requests library. It intercepts HTTP requests made during tests, matches them against previously recorded interactions stored in cassette files, and either returns the recorded response or records a new one if allowed. This eliminates the need for live API calls during testing, making tests faster, more reliable, and independent of external service availability.
You configure a cassette library directory, wrap your requests.Session in a Betamax context manager, and specify which cassette to use. On first run, real requests are made and recorded; on subsequent runs, the recorded responses are replayed. The package supports Python 3.8, 3.9, 3.10, 3.11 and PyPy, though development has been dormant since the last release in 2024-02-08.
Use it for:
- Write unit tests for code that calls external APIs without requiring those services to be running or available.
- Record real API responses once, then replay them consistently across CI/CD pipelines and local development.
- Test error handling and edge cases by editing cassette files to inject specific response scenarios.
- Speed up test suites by eliminating network latency from HTTP-dependent tests.
- Ensure test reproducibility by decoupling test execution from third-party API changes or downtime.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Betamax records and replays HTTP interactions made through the requests library, allowing you to mock external API calls in tests without making live network requests.
Yes, if you need HTTP request mocking for requests-based code. Betamax is stable, permissively licensed, and has low install friction. No vulnerabilities are reported. The dormant maintenance is a minor concern—verify that it works with your current Python and requests versions before adopting it in a new project.
Install
betamax on PyPI
pip
pip install betamaxuv
uv add betamaxpoetry
poetry add betamaxInstalling betamax
Before you install
Low install friction with a single runtime dependency (requests). Maintenance is dormant—last release was 2024-02-08—but the package is marked Production/Stable and the repository remains unarchived.
License in practice
Licensed under Apache-2.0 (permissive), so you can use it freely in commercial and open-source projects without copyleft obligations.
Quickstart
pip install betamax
from betamax import Betamax
from requests import Session
with Betamax.configure() as config:
config.cassette_library_dir = 'tests/fixtures/cassettes'
with Betamax(Session()).use_cassette('example'):
resp = Session().get('https://api.example.com/data')
Requires Python 3.8.1 or later and the requests library installed.
Verify before relying
- Whether cassette format remains compatible with current VCR versions beyond what the description states.
- Current test coverage and whether the dormant maintenance status affects reliability for new Python releases.
- How long the package can remain viable without active maintenance as Python and requests evolve.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.8.1) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — requests |
| Maintenance | dormant — 918 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 85,678/month — #13,907 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: betamax-0.9.0-py2.py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
vcrpyVCR.py records HTTP interactions during test…
permissive · top 1,000 on PyPI
pytest-recordingA pytest plugin that records and replays HTTP…
permissive · top 5,000 on PyPI
keboola.vcrRecords, sanitizes, and validates HTTP…
permissive · top 15,000 on PyPI
pytest-vcrA pytest plugin that integrates VCR.py to…
permissive · top 5,000 on PyPI
placeboPlacebo records and replays AWS API calls…
permissive · top 15,000 on PyPI
urllib3-mockMocks urllib3 HTTP requests in tests by…
permissive · top 15,000 on PyPI
httmockIntercepts and mocks HTTP requests made by the…
permissive · top 5,000 on PyPI
responsesMocks HTTP requests made by the requests…
permissive · top 1,000 on PyPI
respxRESPX mocks HTTPX and HTTP Core libraries for…
permissive · top 1,000 on PyPI
pytest-responsesAutomatically mocks HTTP requests across your…
permissive · top 15,000 on PyPI