|
7 | 7 |
|
8 | 8 | import httpx |
9 | 9 |
|
10 | | -from ...constants import DEFAULT_HEADERS, HTTP_TIMEOUT |
| 10 | +from ...constants import DEFAULT_HEADERS, DEFAULT_HTTP_TIMEOUT |
11 | 11 | from ...errors import AiolaError |
12 | 12 | from ...types import AiolaClientOptions, GrantTokenResponse, SessionCloseResponse |
13 | 13 |
|
@@ -85,7 +85,7 @@ def grant_token(api_key: str, auth_base_url: str, workflow_id: str) -> GrantToke |
85 | 85 | "Authorization": f"Bearer {api_key}", |
86 | 86 | } |
87 | 87 | # Generate temporary token |
88 | | - with httpx.Client(timeout=HTTP_TIMEOUT) as client: |
| 88 | + with httpx.Client(timeout=DEFAULT_HTTP_TIMEOUT) as client: |
89 | 89 | token_response = client.post( |
90 | 90 | token_endpoint, |
91 | 91 | headers=headers, |
@@ -152,7 +152,7 @@ async def async_grant_token(api_key: str, auth_base_url: str, workflow_id: str) |
152 | 152 | session_endpoint = f"{auth_base_url}/voip-auth/session" |
153 | 153 |
|
154 | 154 | # Generate temporary token |
155 | | - async with httpx.AsyncClient(timeout=HTTP_TIMEOUT) as client: |
| 155 | + async with httpx.AsyncClient(timeout=DEFAULT_HTTP_TIMEOUT) as client: |
156 | 156 | token_response = await client.post( |
157 | 157 | token_endpoint, headers={**DEFAULT_HEADERS, "Authorization": f"Bearer {api_key}"} |
158 | 158 | ) |
@@ -214,7 +214,7 @@ async def async_close_session(access_token: str, auth_base_url: str) -> SessionC |
214 | 214 | auth_base_url = auth_base_url.rstrip("/") |
215 | 215 | session_endpoint = f"{auth_base_url}/voip-auth/session" |
216 | 216 |
|
217 | | - async with httpx.AsyncClient(timeout=HTTP_TIMEOUT) as client: |
| 217 | + async with httpx.AsyncClient(timeout=DEFAULT_HTTP_TIMEOUT) as client: |
218 | 218 | response = await client.delete( |
219 | 219 | session_endpoint, |
220 | 220 | headers={ |
@@ -283,7 +283,7 @@ def get_access_token(self, access_token: str, api_key: str, workflow_id: str) -> |
283 | 283 | def _api_key_to_token(self, api_key: str) -> str: |
284 | 284 | """Generate a temporary JWT token from API key.""" |
285 | 285 | try: |
286 | | - with httpx.Client(timeout=HTTP_TIMEOUT) as client: |
| 286 | + with httpx.Client(timeout=DEFAULT_HTTP_TIMEOUT) as client: |
287 | 287 | response = client.post( |
288 | 288 | f"{self._options.auth_base_url}/voip-auth/apiKey2Token", |
289 | 289 | headers={**DEFAULT_HEADERS, "Authorization": f"Bearer {api_key}"}, |
@@ -316,7 +316,7 @@ def _create_session(self, token: str, workflow_id: str) -> dict[str, str]: |
316 | 316 | body = {"workflow_id": workflow_id} |
317 | 317 | headers = {**DEFAULT_HEADERS, "Content-Type": "application/json", "Authorization": f"Bearer {token}"} |
318 | 318 |
|
319 | | - with httpx.Client(timeout=HTTP_TIMEOUT) as client: |
| 319 | + with httpx.Client(timeout=DEFAULT_HTTP_TIMEOUT) as client: |
320 | 320 | response = client.post( |
321 | 321 | f"{self._options.auth_base_url}/voip-auth/session", |
322 | 322 | headers=headers, |
@@ -375,7 +375,7 @@ def close_session(access_token: str, auth_base_url: str) -> SessionCloseResponse |
375 | 375 | auth_base_url = auth_base_url.rstrip("/") |
376 | 376 | session_endpoint = f"{auth_base_url}/voip-auth/session" |
377 | 377 |
|
378 | | - with httpx.Client(timeout=HTTP_TIMEOUT) as client: |
| 378 | + with httpx.Client(timeout=DEFAULT_HTTP_TIMEOUT) as client: |
379 | 379 | response = client.delete( |
380 | 380 | session_endpoint, |
381 | 381 | headers={ |
@@ -516,7 +516,7 @@ async def get_access_token(self, access_token: str, api_key: str, workflow_id: s |
516 | 516 | async def _api_key_to_token(self, api_key: str) -> str: |
517 | 517 | """Generate a temporary JWT token from API key.""" |
518 | 518 | try: |
519 | | - async with httpx.AsyncClient(timeout=HTTP_TIMEOUT) as client: |
| 519 | + async with httpx.AsyncClient(timeout=DEFAULT_HTTP_TIMEOUT) as client: |
520 | 520 | response = await client.post( |
521 | 521 | f"{self._options.auth_base_url}/voip-auth/apiKey2Token", |
522 | 522 | headers={**DEFAULT_HEADERS, "Authorization": f"Bearer {api_key}"}, |
@@ -548,7 +548,7 @@ async def _create_session(self, token: str, workflow_id: str) -> dict[str, str]: |
548 | 548 | try: |
549 | 549 | body = {"workflow_id": workflow_id} |
550 | 550 |
|
551 | | - async with httpx.AsyncClient(timeout=HTTP_TIMEOUT) as client: |
| 551 | + async with httpx.AsyncClient(timeout=DEFAULT_HTTP_TIMEOUT) as client: |
552 | 552 | response = await client.post( |
553 | 553 | f"{self._options.auth_base_url}/voip-auth/session", |
554 | 554 | headers={**DEFAULT_HEADERS, "Content-Type": "application/json", "Authorization": f"Bearer {token}"}, |
|
0 commit comments