Cassette
Store and replay HTTP requests made in your Python app
Install / Use
/learn @uber/CassetteREADME
Cassette
Deprecation Warning: cassette has some known limitations and is not maintained anymore, we recommend using vcrpy <https://github.com/kevin1024/vcrpy>_ instead.
.. image:: https://img.shields.io/pypi/v/cassette.svg
Cassette stores and replays HTTP requests made in your Python app.
.. code:: python
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 <https://github.com/kennethreitz/requests>_
library.
.. code:: python
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
.. code-block:: sh
$ pip install cassette
Documentation
Latest documentation: cassette.readthedocs.org <http://cassette.readthedocs.org/>_
License
cassette is available under the MIT License.
Copyright Uber 2013, Charles-Axel Dein charles@uber.com
Related Skills
node-connect
341.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.6kCommit, push, and open a PR
