From 5907bd831d15e7346f291041da598857606ee4dd Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Tue, 24 Feb 2026 09:41:22 +0000 Subject: [PATCH] Fix --- conjure_python_client/_http/requests_client.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/conjure_python_client/_http/requests_client.py b/conjure_python_client/_http/requests_client.py index 4d776226..b7df7a99 100644 --- a/conjure_python_client/_http/requests_client.py +++ b/conjure_python_client/_http/requests_client.py @@ -26,7 +26,6 @@ import random import requests import socket -import sys T = TypeVar("T") @@ -55,13 +54,15 @@ socket.SO_KEEPALIVE, 1, ) # Enable keep alive. -SOCKET_KEEP_INTVL = ( - socket.SOL_TCP, - socket.TCP_KEEPINTVL, - 120, -) # Interval of 120s between individual keepalive probes. -KEEP_ALIVE_SOCKET_OPTIONS = [SOCKET_KEEP_ALIVE, SOCKET_KEEP_INTVL] -if sys.platform != "darwin": +KEEP_ALIVE_SOCKET_OPTIONS = [SOCKET_KEEP_ALIVE] +if hasattr(socket, "TCP_KEEPINTVL"): + SOCKET_KEEP_INTVL = ( + socket.SOL_TCP, + socket.TCP_KEEPINTVL, + 120, + ) # Interval of 120s between individual keepalive probes. + KEEP_ALIVE_SOCKET_OPTIONS.append(SOCKET_KEEP_INTVL) +if hasattr(socket, "TCP_KEEPIDLE"): SOCKET_KEEP_IDLE = ( socket.SOL_TCP, socket.TCP_KEEPIDLE,