self.status = recorded_response['status']['code']
self.version = None
self._content = StringIO(self.recorded_response['body']['string'])
- self.closed = False
+ self.closed = False
# We are skipping the header parsing (they have already been parsed
# at this point) and directly adding the headers to the header
def close(self):
self._restore_socket()
- self._baseclass.close(self)
+ self._baseclass.close(self)
def _restore_socket(self):
"""
- Since some libraries (REQUESTS!!) decide to set options on
- connection.socket, I need to delete the socket attribute
- (which makes requests think this is a AppEngine connection)
- and then restore it when I want to make the actual request.
- This function restores it to its standard initial value
- (which is None)
+ Since some libraries (REQUESTS!!) decide to set options on
+ connection.socket, I need to delete the socket attribute
+ (which makes requests think this is a AppEngine connection)
+ and then restore it when I want to make the actual request.
+ This function restores it to its standard initial value
+ (which is None)
"""
- if not hasattr(self, 'sock'):
+ if not hasattr(self, 'sock'):
self.sock = None
def _send_request(self, method, url, body, headers):
if isinstance(message_body, str):
msg += message_body
message_body = None
- self._restore_socket()
+ self._restore_socket()
self._baseclass.send(self, msg)
if message_body is not None:
#message_body was not a string (i.e. it is a file) and
# Otherwise, we should send the request, then get the response
# and return it.
- # restore sock's value to None, since we need a real socket
- self._restore_socket()
+ # restore sock's value to None, since we need a real socket
+ self._restore_socket()
- #make the actual request
+ #make the actual request
self._baseclass.request(
self,
method=self._vcr_request.method,
def __init__(self, *args, **kwargs):
HTTPConnection.__init__(self, *args, **kwargs)
- # see VCRConnectionMixin._restore_socket for the motivation here
- del self.sock
+ # see VCRConnectionMixin._restore_socket for the motivation here
+ del self.sock
class VCRHTTPSConnection(VCRConnectionMixin, HTTPSConnection):
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
+ # see VCRConnectionMixin._restore_socket for the motivation here
+ del self.sock