--- id: betamax version: "0.9.0" license: Apache-2.0 license_treatment: permissive maintenance: dormant --- # betamax — A VCR imitation for python-requests License: permissive · Maintenance: dormant · Downloads: 85.7K/mo ## 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 above — 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 pip install betamax uv add betamax 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_current - Install friction: low - Maintenance: dormant - Downloads: 85.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags HTTP request mocking, VCR for requests, record replay HTTP, API testing without network, cassette-based request mocking, requests library test fixtures, mock external API calls, testing, http-mocking, vcr-compatible [View on SkillFed](https://skillfed.io/packages/betamax) · [View on PyPI](https://pypi.org/project/betamax/)