From 14ef1e87f72034c677553e779faf2206154e24fe Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 8 Jan 2015 14:00:33 -0800 Subject: [PATCH] Add custom_patches section to README.md --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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