{"id":23353,"library":"betamax","title":"Betamax","description":"A VCR imitation for python-requests that records HTTP interactions and replays them during tests. Current version 0.9.0; release cadence is low (last release 2023).","status":"active","version":"0.9.0","language":"python","source_language":"en","source_url":"https://github.com/sigmavirus24/betamax","tags":["testing","vcr","http","mock"],"install":[{"cmd":"pip install betamax","lang":"bash","label":"Standard install"}],"dependencies":[],"imports":[{"note":"BetamaxSession does not exist; the correct class is Betamax.","wrong":"from betamax import BetamaxSession","symbol":"Betamax","correct":"from betamax import Betamax"},{"note":"Do not manually start/stop; use as context manager.","wrong":"recorder = Betamax(session); recorder.start()","symbol":"recorder","correct":"with Betamax(session) as recorder:"}],"quickstart":{"code":"import requests\nfrom betamax import Betamax\n\nsession = requests.Session()\nrecorder = Betamax(session)\n\nwith recorder.use_cassette('example'):\n    response = session.get('https://httpbin.org/get')\n    print(response.status_code)","lang":"python","description":"Record and replay HTTP requests using Betamax with a requests.Session."},"warnings":[{"fix":"Upgrade requests to >=2.0.","message":"python-requests < 2.0 are not supported. Betamax requires requests 2.x.","severity":"deprecated","affected_versions":"<0.9.0"},{"fix":"Ensure the cassettes directory exists or set a custom cassette_library_dir.","message":"Cassette files are stored in a 'cassettes/' directory by default. Forgetting to create this directory or adjust the path can cause FileNotFoundError.","severity":"gotcha","affected_versions":"all"},{"fix":"Configure matchers via Betamax(matchers=...) or use default Matchers.","message":"Betamax does not match requests purely by URL; it uses request method, URI, and (optionally) headers/body. Mismatches lead to cassette playback failures.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Create a 'cassettes' folder in your working directory, or set cassette_library_dir to an existing path.","cause":"Default cassette_library_dir is 'cassettes/' and it does not exist.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'cassettes/example.json'"},{"fix":"Ensure that the request (method, URI, headers, body) exactly matches the recorded interaction. Or use 'record_mode' to allow recording.","cause":"The request being made does not match any recorded cassette; maybe headers or body differ.","error":"No cassette found for request: GET http://httpbin.org/get"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}