1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00
Files
vcrpy/vcr/files.py
2012-05-30 20:52:26 -10:00

18 lines
417 B
Python

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())