mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
Remove Some stray \t characters
I guess that's what I get for playing around with my vimrc. Thanks to @bryanhelmig for pointing these out.
This commit is contained in:
@@ -16,7 +16,7 @@ class VCRHTTPResponse(object):
|
||||
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
|
||||
@@ -81,18 +81,18 @@ class VCRConnectionMixin:
|
||||
|
||||
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):
|
||||
@@ -150,7 +150,7 @@ class VCRConnectionMixin:
|
||||
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
|
||||
@@ -175,10 +175,10 @@ class VCRConnectionMixin:
|
||||
# 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,
|
||||
@@ -211,8 +211,8 @@ class VCRHTTPConnection(VCRConnectionMixin, HTTPConnection):
|
||||
|
||||
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):
|
||||
@@ -227,5 +227,5 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user