All Projects → betamaxpy → Betamax

betamaxpy / Betamax

Licence: other
A VCR imitation designed only for python-requests.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Betamax

rdScreenRecordSDK-for-Windows
Windows录屏SDK
Stars: ✭ 19 (-95.94%)
Mutual labels:  recording
amanuensis
The Amanuensis is an automated songwriting and recording system aimed at ridding the process of anything left-brained, so one need never leave a creative, spontaneous and improvisational state of mind, from the inception of the song until its final master. See the README for instructions and feel free to message me at soundcloud.com/to_the_sun.
Stars: ✭ 30 (-93.59%)
Mutual labels:  recording
cm
Configuration management for all VOC systems
Stars: ✭ 17 (-96.37%)
Mutual labels:  recording
vcr.js
Mock server with Proxy and Record support inspired by ruby VCR.
Stars: ✭ 41 (-91.24%)
Mutual labels:  recording
SWET
Selenium WebDriver Page Test / workflow recorder (successor to SWD recorder)
Stars: ✭ 34 (-92.74%)
Mutual labels:  recording
MIDITapeRecorder
AUv3 MIDI Tape Recorder
Stars: ✭ 91 (-80.56%)
Mutual labels:  recording
uos
United Open-libraries of Sound. United procedures for open-source audio libraries. For FPC/Lazarus/fpGUI/MSEgui.
Stars: ✭ 112 (-76.07%)
Mutual labels:  recording
Animatedrecordingview
Android animated recording view
Stars: ✭ 345 (-26.28%)
Mutual labels:  recording
streamdvr
DVR for streaming entertainment
Stars: ✭ 51 (-89.1%)
Mutual labels:  recording
termbacktime
Terminal recording and playback.
Stars: ✭ 33 (-92.95%)
Mutual labels:  recording
Media-Recorder-API-Demo
An implementation of the MediaStream Recording API
Stars: ✭ 122 (-73.93%)
Mutual labels:  recording
ZFScreenRecorder
录屏,支持暂停、取消
Stars: ✭ 38 (-91.88%)
Mutual labels:  recording
CAM
macOS camera recording using ffmpeg
Stars: ✭ 43 (-90.81%)
Mutual labels:  recording
txproto
Scriptable multimedia sandbox. Captures, streams and records from a variety of sources.
Stars: ✭ 68 (-85.47%)
Mutual labels:  recording
pedalboard
Online guitar pedalboard
Stars: ✭ 48 (-89.74%)
Mutual labels:  recording
midi-recorder
🎹 The easiest way to record MIDI. No install. Automatically records.
Stars: ✭ 38 (-91.88%)
Mutual labels:  recording
SwiftUIViewRecorder
Efficiently record any SwiftUI View as image or video
Stars: ✭ 20 (-95.73%)
Mutual labels:  recording
Recordmp3js
Record MP3 files directly from the browser using JS and HTML
Stars: ✭ 413 (-11.75%)
Mutual labels:  recording
reading books record repository
📚 책을 읽고 정리합니다. 📖 Summary of Books 👉 우리 같이 책을 읽어볼까요?
Stars: ✭ 25 (-94.66%)
Mutual labels:  recording
scr
🎤 A Super CRappy SCReenshot & SCreen Recording SCRipt for Sound Cloud Rappers + audio recorder, yes (sponsored by https://git.io/kiwmi)
Stars: ✭ 16 (-96.58%)
Mutual labels:  recording

betamax

Betamax is a VCR_ imitation for requests. This will make mocking out requests much easier. It is tested on Travis CI_.

Put in a more humorous way: "Betamax records your HTTP interactions so the NSA does not have to."

Example Use

.. code-block:: python

from betamax import Betamax
from requests import Session
from unittest import TestCase

with Betamax.configure() as config:
    config.cassette_library_dir = 'tests/fixtures/cassettes'


class TestGitHubAPI(TestCase):
    def setUp(self):
        self.session = Session()
        self.headers.update(...)

    # Set the cassette in a line other than the context declaration
    def test_user(self):
        with Betamax(self.session) as vcr:
            vcr.use_cassette('user')
            resp = self.session.get('https://api.github.com/user',
                                    auth=('user', 'pass'))
            assert resp.json()['login'] is not None

    # Set the cassette in line with the context declaration
    def test_repo(self):
        with Betamax(self.session).use_cassette('repo'):
            resp = self.session.get(
                'https://api.github.com/repos/sigmavirus24/github3.py'
                )
            assert resp.json()['owner'] != {}

What does it even do?

If you are unfamiliar with VCR_, you might need a better explanation of what Betamax does.

Betamax intercepts every request you make and attempts to find a matching request that has already been intercepted and recorded. Two things can then happen:

  1. If there is a matching request, it will return the response that is associated with it.
  2. If there is not a matching request and it is allowed to record new responses, it will make the request, record the response and return the response.

Recorded requests and corresponding responses - also known as interactions - are stored in files called cassettes. (An example cassette can be seen in the examples section of the documentation.) The directory you store your cassettes in is called your library, or your cassette library.

VCR Cassette Compatibility

Betamax can use any VCR-recorded cassette as of this point in time. The only caveat is that python-requests returns a URL on each response. VCR does not store that in a cassette now but we will. Any VCR-recorded cassette used to playback a response will unfortunately not have a URL attribute on responses that are returned. This is a minor annoyance but not something that can be fixed.

.. _VCR: https://github.com/vcr/vcr .. _Travis CI: https://travis-ci.org/sigmavirus24/betamax .. _examples section of the documentation: http://betamax.readthedocs.org/en/latest/api.html#examples .. _cassette library: http://betamax.readthedocs.org/en/latest/cassettes.html

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].