-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
requests-unixsocket should use the same timeout interface as requests. #44
Comments
I think your second issue may be satisfied with https://github.com/msabramo/requests-unixsocket/pull/42/files (not released yet) and something like:
|
https://pypi.org/project/requests-unixsocket/0.3.0/ now has #42 in case that helps. |
BREAKING CHANGE: Remove timeout code and `timeout` parameter from method signatures, because it gives the impression of doing something, but seems to be ineffective (see #44).
It looks to me like the timeout code I have isn't actually taking effect, maybe because I made this small change to add some debugging: diff --git a/requests_unixsocket/adapters.py b/requests_unixsocket/adapters.py
index 83e1400..42ef5d6 100644
--- a/requests_unixsocket/adapters.py
+++ b/requests_unixsocket/adapters.py
@@ -28,6 +28,7 @@ class UnixHTTPConnection(httplib.HTTPConnection, object):
super(UnixHTTPConnection, self).__init__('localhost', timeout=timeout)
self.unix_socket_url = unix_socket_url
self.timeout = timeout
+ print(f'UnixHTTPConnection.__init__: self.timeout = {self.timeout}')
self.sock = None
def __del__(self): # base class does not have d'tor
@@ -36,6 +37,7 @@ class UnixHTTPConnection(httplib.HTTPConnection, object):
def connect(self):
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+ print(f'UnixHTTPConnection.connect: self.timeout = {self.timeout}')
sock.settimeout(self.timeout)
socket_path = unquote(urlparse(self.unix_socket_url).netloc)
sock.connect(socket_path) and then I do this:
Notice how my code sets The other thing that I'm noticing is that if I specify a
So it seems to me that despite the incorrect-looking code that I have, the right thing seems to be happening (purely by accident 😄) and therefore I am inclined to simply remove my wrong-looking but ineffective and confusing timeout code and do a new release where I mark this as a breaking change, since I'd be removing the See #62 |
BREAKING CHANGE: Remove timeout code and `timeout` parameter from method signatures, because it gives the impression of doing something, but seems to be ineffective (see #44 (comment)).
BREAKING CHANGE: Remove timeout code and `timeout` parameter from method signatures, because it gives the impression of doing something, but seems to be ineffective (see #44 (comment)). Sem-Ver: api-break
It seems like requests-unixsocket currently has its own way of setting timeouts, which differs from requests itself.
UnixAdapter
, which is inaccessible, if one usesrequests_unixsocket.Session
.The text was updated successfully, but these errors were encountered: