From: Ivan Malison Date: Thu, 8 Jan 2015 22:00:33 +0000 (-0800) Subject: Add custom_patches section to README.md X-Git-Tag: v1.3.0~8 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=14ef1e87f72034c677553e779faf2206154e24fe;p=vcrpy.git Add custom_patches section to README.md --- diff --git a/README.md b/README.md index 21b71ce..8b02f41 100644 --- a/README.md +++ b/README.md @@ -362,6 +362,23 @@ back from a cassette. VCR will completely ignore those requests as if it didn't notice them at all, and they will continue to hit the server as if VCR were not there. +## Custom Patches + +If you use a custom `HTTPConnection` class, or otherwise make http +requests in a way that requires additional patching, you can use the +`custom_patches` keyword argument of the `VCR` and `Cassette` objects +to patch those objects whenever a cassette's context is entered. To +patch a custom version of `HTTPConnection` you can do something like +this: + +``` +import where_the_custom_https_connection_lives +from vcr.stubs import VCRHTTPSConnection +my_vcr = config.VCR(custom_patches=((where_the_custom_https_connection_lives, 'CustomHTTPSConnection', VCRHTTPSConnection),)) + +@my_vcr.use_cassette(...) +``` + ## Installation VCR.py is a package on PyPI, so you can `pip install vcrpy` (first you may need