Skip to content

Instantly share code, notes, and snippets.

@svdgraaf

svdgraaf/vcr.py

Created Oct 1, 2019
Embed
What would you like to do?
vcrpy example
import os
import requests
import unittest
import vcr
dir_path = os.path.dirname(os.path.realpath(__file__))
dd_vcr = vcr.VCR(
cassette_library_dir="%s/cassettes" % dir_path,
path_transformer=vcr.VCR.ensure_suffix(".yml"),
record_mode="once",
filter_headers=[
("authorization", "XXXXXX"),
("X-Amz-Security-Token", "XXXXXX"),
("X-Amz-Date", "XXXXXX"),
("X-Amz-Target", "XXXXXX"),
],
match_on=['method', 'scheme', 'host', 'port', 'path', 'query'],
)
class FoobarTest(unittest.TestCase):
@dd_vcr.use_cassette
def test_foobar(self):
results = requests.get("https://downdetector.com/")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment