def request(self, method, url, body=None, headers=None):
'''Persist the request metadata in self._vcr_request'''
+ # see VCRConnectionMixin._restore_socket for the motivation here
+ if hasattr(self, 'sock'):
+ del self.sock
+
self._vcr_request = Request(
protocol=self._protocol,
host=self.host,
_baseclass = HTTPConnection
_protocol = 'http'
- def __init__(self, *args, **kwargs):
- HTTPConnection.__init__(self, *args, **kwargs)
- # see VCRConnectionMixin._restore_socket for the motivation here
- del self.sock
-
class VCRHTTPSConnection(VCRConnectionMixin, HTTPSConnection):
'''A Mocked class for HTTPS requests'''
HTTPConnection.__init__(self, *args, **kwargs)
self.key_file = kwargs.pop('key_file', None)
self.cert_file = kwargs.pop('cert_file', None)
- # see VCRConnectionMixin._restore_socket for the motivation here
- del self.sock