We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2394b35 commit d9aac74Copy full SHA for d9aac74
dkg/providers/node/async_node_http.py
@@ -30,8 +30,10 @@ def __init__(
30
endpoint_uri: URI | str,
31
api_version: str = "v1",
32
auth_token: str | None = None,
33
+ timeout: int = 60, # timeout in seconds
34
):
35
super().__init__(endpoint_uri, api_version, auth_token)
36
+ self.timeout = timeout
37
38
async def make_request(
39
self,
@@ -42,7 +44,9 @@ async def make_request(
42
44
) -> NodeResponseDict:
43
45
url = f"{self.url}/{path}"
46
- async with aiohttp.ClientSession() as session:
47
+ timeout_config = aiohttp.ClientTimeout(total=self.timeout)
48
+
49
+ async with aiohttp.ClientSession(timeout=timeout_config) as session:
50
try:
51
if method == HTTPRequestMethod.GET:
52
async with session.get(
0 commit comments