skillfed

betamax

A VCR imitation for python-requests

betamax v0.9.0 85.7K downloads/30d#13,907 on PyPI583
Permissive license Apache-2.0 DORMANT released

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 betamax

uv

uv add betamax

poetry

poetry add betamax

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality Assurance

Tags

HTTP request mockingVCR for requestsrecord replay HTTPAPI testing without networkcassette-based request mockingrequests library test fixturesmock external API calls
testinghttp-mockingvcr-compatible

More Python Modules packages