1
0
This commit is contained in:
2025-08-02 23:05:28 +09:00
commit 1d7a27c89f
4 changed files with 238 additions and 0 deletions

14
adapter.py Normal file
View File

@@ -0,0 +1,14 @@
from requests.adapters import HTTPAdapter
class WhyTheFuckRequestsHasNoTimeoutInAdapter(HTTPAdapter):
def __init__(self, *args, **kwargs):
if "timeout" in kwargs:
self.timeout = kwargs["timeout"]
del kwargs["timeout"]
super().__init__(*args, **kwargs)
def send(self, request, **kwargs):
timeout = kwargs.get("timeout")
if timeout is None and hasattr(self, 'timeout'):
kwargs["timeout"] = self.timeout
return super().send(request, **kwargs)