Coder Social home page Coder Social logo

afcarl / cassette Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uber/cassette

0.0 1.0 0.0 963 KB

Store and replay HTTP requests made in your Python app

Home Page: http://cassette.readthedocs.org/

License: Other

Makefile 0.88% Python 99.12%

cassette's Introduction

Cassette

Deprecation Warning: cassette has some known limitations and is not maintained anymore, we recommend using vcrpy instead.

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 <[email protected]>

cassette's People

Contributors

blampe avatar carolinevdh avatar charlax avatar dnathe4th avatar kevin1024 avatar kmnovak avatar roguelazer avatar twolfson avatar zheller avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.