From 7a4c11bf949da6c526fe9d1e883c74c0a05b368f Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Mon, 19 Aug 2013 19:17:24 -1000 Subject: [PATCH] clarify the readme a bit --- README.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a1c050b..3e2044c 100644 --- a/README.md +++ b/README.md @@ -111,17 +111,37 @@ The Request object has the following properties ## Register your own serializer +Don't like JSON or YAML? That's OK, VCR.py can serialize to any format +you would like. Create your own class that has 2 classmethods: + + * `def load(cls, cassette_path)` + * `def dumps(cls, requests, responses)` + +Finally, register your class with VCR to use your +new serializer. + ``` import vcr -MySerializer(object): +BogoSerializer(object): """ - Must implement serialize() and deserialize() classmethods + Must implement load() and dumps() classmethods """ pass my_vcr = VCR() -my_vcr.register_serializer('my', MySerializer) +my_vcr.register_serializer('bogo', BogoSerializer) + +with my_vcr.use_cassette('test.bogo', serializer='bogo'): + # your http here + +# After you register, you can set the default serializer to your new serializer + +my_vcr.serializer = 'bogo' + +with my_vcr.use_cassette('test.bogo'): + # your http here + ``` ##Installation