]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
document configuration stuffs
authorKevin McCarthy <me@kevinmccarthy.org>
Tue, 20 Aug 2013 04:36:40 +0000 (18:36 -1000)
committerKevin McCarthy <me@kevinmccarthy.org>
Tue, 20 Aug 2013 05:49:05 +0000 (19:49 -1000)
README.md

index f024fd023c78070d02991778156bd9c30d943164..31fafa76d9f5937e3ecf318657be2d8f58a476cb 100644 (file)
--- a/README.md
+++ b/README.md
@@ -38,6 +38,31 @@ pass, even if you are offline, or iana.org goes down for maintenance) and
 accurate (the response will contain the same headers and body you get from a
 real request).
 
+## Configuration
+
+If you don't like VCR's defaults, you can set options by instantiating a
+VCR class and setting the options on it.
+
+```python
+
+import vcr
+
+my_vcr = vcr.VCR(
+    serializer = 'json',
+    cassette_library_dir = 'fixtures/cassettes',
+)
+
+with my_vcr.use_cassette('test.json'):
+    # your http code here
+```
+
+Otherwise, you can override options each time you use a cassette.  
+
+```python
+with my_vcr.use_cassette('test.yml', serializer='json'):
+    # your http code here
+```
+
 ## Advanced Features
 
 If you want, VCR.py can return information about the cassette it is
@@ -82,7 +107,20 @@ The Request object has the following properties
   * `protocol`: The protocol used to make the request (http or https)
   * `body`: The body of the request, usually empty except for POST / PUT / etc
 
+## Register your own serializer
 
+```
+import vcr
+
+MySerializer(object):
+    """
+    Must implement serialize() and deserialize() functions
+    """
+    pass
+
+my_vcr = VCR()
+my_vcr.register_serializer(MySerializer)
+```
 
 ##Installation