Created
October 1, 2019 14:23
-
-
Save svdgraaf/7f56596fb9f3bfddd599ef9966b5f775 to your computer and use it in GitHub Desktop.
vcrpy example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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