Skip to main content

Cassette

Cassette stores and replays HTTP requests made in your Python app.

import urllib2

import cassette

with cassette.play("data/responses.yaml"):

    # If the request is not already stored in responses.yaml, cassette
    # will request the URL and store its response in the file.
    r = urllib2.urlopen("http://www.internic.net/domain/named.root")

    # This time, the request response must be in the file. The external
    # request is not made. cassette retrieves the response from the
    # file.
    r = urllib2.urlopen("http://www.internic.net/domain/named.root")

assert "A.ROOT-SERVERS.NET" in r.read(10000)

Cassette also supports the requests library.

import requests

with cassette.play("data/responses.yaml"):
    r = requests.get("http://www.internic.net/domain/named.root")

Note that requests stored between different libraries may not be compatible with each other. That is, a request stored with urllib2 might still trigger an external request is the same URL is requested with requests.

Installation

$ pip install cassette

Documentation

Latest documentation: cassette.readthedocs.org

License

cassette is available under the MIT License.

Copyright Uber 2013, Charles-Axel Dein <charles@uber.com>

Metadata

Release files for cassette 0.3.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cassette 0.3.8
File Size Uploaded Provenance Actions
cassette-0.3.8.zip 25.4 kB Without provenance Details for cassette-0.3.8.zip

Release files / cassette-0.3.8.zip

Download URL cassette-0.3.8.zip
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fe09b7223ef14f93f1d58be51e959bf99df3422e7fb15aaa36fcd834b68bbade
BLAKE2b-256 checksum
How to use checksums
afd9a05e70aac583b9bbe4c31e9af20f9c100b08a92b4b15b2fee7efeba8dbf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cassette 0.3.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page