API Reference

VCR.py

Records HTTP interactions to cassettes and replays them so tests run without network access.

Official Documentation ↗
CompatibilityThis documentation covers version v6.0. Check the official docs for the latest API surface.

Installation

pippip install vcrpy

Methods

VCR.py intercepts HTTP libraries, saves requests and responses, and replays them later.

Key Features

  • Cassette recording and replay
  • Record modes for new versus existing interactions
  • Works across common HTTP libraries

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

API reference evidence

Fetched from official sources on 2026-11-08T09:53:13.312Z via WebFetch https://vcrpy.readthedocs.io/en/latest/api.html.

FAQ

How do I refresh a cassette?
Delete the file and rerun with record_mode="all" or "new_episodes" so interactions are recorded again.
Why does playback fail?
The request signature must match; adjust match_on to ignore volatile headers, and confirm the cassette contains the call.
Should cassettes be committed?
Yes for deterministic tests, but scrub secrets first since headers and bodies are stored in plain text.