mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-10 17:45:35 +00:00
initial commit
This commit is contained in:
17
vcr/files.py
Normal file
17
vcr/files.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import os
|
||||
import yaml
|
||||
|
||||
def load_cassette(cassette_path):
|
||||
try:
|
||||
return yaml.load(open(cassette_path))
|
||||
except IOError:
|
||||
return None
|
||||
|
||||
def save_cassette(cassette_path,cassette):
|
||||
dirname,filename = os.path.split(cassette_path)
|
||||
if not os.path.exists(dirname):
|
||||
os.makedirs(dirname)
|
||||
with open(cassette_path,'wc') as cassette_file:
|
||||
cassette_file.write(cassette.serialize())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user