Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uber/cassette
Store and replay HTTP requests made in your Python app
https://github.com/uber/cassette
Last synced: 4 days ago
JSON representation
Store and replay HTTP requests made in your Python app
- Host: GitHub
- URL: https://github.com/uber/cassette
- Owner: uber
- License: other
- Created: 2013-02-01T03:21:13.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2023-05-01T21:41:43.000Z (over 1 year ago)
- Last Synced: 2024-08-02T14:12:22.503Z (3 months ago)
- Language: Python
- Homepage: http://cassette.readthedocs.org/
- Size: 940 KB
- Stars: 138
- Watchers: 2,732
- Forks: 20
- Open Issues: 7
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
Cassette
========**Deprecation Warning**: cassette has some known limitations and is not maintained anymore, we recommend using `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 `_
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 `_
License
-------cassette is available under the MIT License.
Copyright Uber 2013, Charles-Axel Dein