Skip to content

Commit 23cc332

Browse files
authored
fix: timeout (#522)
* fix: timeout * fix: timeout
1 parent 47e4dec commit 23cc332

File tree

12 files changed

+16
-12
lines changed

12 files changed

+16
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [unreleased]
1010

11+
## [0.24.1] - 2024-08-16
12+
13+
- Sets time out for httpx client to 30s everywhere. - https://github.com/supertokens/supertokens-python/issues/516
14+
1115
## [0.24.0] - 2024-07-31
1216

1317
### Changes

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383

8484
setup(
8585
name="supertokens_python",
86-
version="0.24.0",
86+
version="0.24.1",
8787
author="SuperTokens",
8888
license="Apache 2.0",
8989
author_email="[email protected]",

supertokens_python/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from __future__ import annotations
1515

1616
SUPPORTED_CDI_VERSIONS = ["3.0"]
17-
VERSION = "0.24.0"
17+
VERSION = "0.24.1"
1818
TELEMETRY = "/telemetry"
1919
USER_COUNT = "/users/count"
2020
USER_DELETE = "/user/remove"

supertokens_python/querier.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async def api_request(
106106
raise Exception("Retry request failed")
107107

108108
try:
109-
async with AsyncClient() as client:
109+
async with AsyncClient(timeout=30.0) as client:
110110
if method == "GET":
111111
return await client.get(url, *args, **kwargs) # type: ignore
112112
if method == "POST":

supertokens_python/recipe/dashboard/api/analytics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def handle_analytics_post(
9393
data["telemetryId"] = telemetry_id
9494

9595
try:
96-
async with AsyncClient() as client:
96+
async with AsyncClient(timeout=30.0) as client:
9797
await client.post( # type: ignore
9898
url=TELEMETRY_SUPERTOKENS_API_URL,
9999
json=data,

supertokens_python/recipe/emailpassword/emaildelivery/services/backward_compatibility/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async def create_and_send_email_using_supertokens_service(
4141
"passwordResetURL": password_reset_url_with_token,
4242
}
4343
try:
44-
async with AsyncClient() as client:
44+
async with AsyncClient(timeout=30.0) as client:
4545
resp = await client.post("https://api.supertokens.io/0/st/auth/password/reset", json=data, headers={"api-version": "0"}) # type: ignore
4646
resp.raise_for_status()
4747
log_debug_message("Password reset email sent to %s", user.email)

supertokens_python/recipe/emailverification/emaildelivery/services/backward_compatibility/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def create_and_send_email_using_supertokens_service(
3838
"emailVerifyURL": email_verification_url,
3939
}
4040
try:
41-
async with AsyncClient() as client:
41+
async with AsyncClient(timeout=30.0) as client:
4242
resp = await client.post("https://api.supertokens.io/0/st/auth/email/verify", json=data, headers={"api-version": "0"}) # type: ignore
4343
resp.raise_for_status()
4444
log_debug_message("Email verification email sent to %s", user.email)

supertokens_python/recipe/passwordless/emaildelivery/services/backward_compatibility/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async def create_and_send_email_with_supertokens_service(
4545
data["userInputCode"] = input_.user_input_code
4646

4747
try:
48-
async with AsyncClient() as client:
48+
async with AsyncClient(timeout=30.0) as client:
4949
resp = await client.post("https://api.supertokens.io/0/st/auth/passwordless/login", json=data, headers={"api-version": "0"}) # type: ignore
5050
resp.raise_for_status()
5151
log_debug_message("Passwordless login email sent to %s", input_.email)

supertokens_python/recipe/passwordless/smsdelivery/services/backward_compatibility/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async def create_and_send_sms_using_supertokens_service(
4646
sms_input_json["urlWithLinkCode"] = input_.url_with_link_code
4747

4848
try:
49-
async with AsyncClient() as client:
49+
async with AsyncClient(timeout=30.0) as client:
5050
res = await client.post( # type: ignore
5151
SUPERTOKENS_SMS_SERVICE_URL,
5252
json={

supertokens_python/recipe/passwordless/smsdelivery/services/supertokens/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async def send_sms(
5050
if template_vars.user_input_code:
5151
sms_input["userInputCode"] = template_vars.user_input_code
5252
try:
53-
async with AsyncClient() as client:
53+
async with AsyncClient(timeout=30.0) as client:
5454
await client.post( # type: ignore
5555
SUPERTOKENS_SMS_SERVICE_URL,
5656
json={

supertokens_python/recipe/thirdparty/providers/custom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ async def verify_id_token_from_jwks_endpoint_and_get_payload(
156156
id_token: str, jwks_uri: str, audience: str
157157
):
158158
public_keys: List[RSAAlgorithm] = []
159-
async with AsyncClient() as client:
159+
async with AsyncClient(timeout=30.0) as client:
160160
response = await client.get(jwks_uri) # type:ignore
161161
key_payload = response.json()
162162
for key in key_payload["keys"]:

supertokens_python/recipe/thirdparty/providers/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async def do_get_request(
3636
if headers is None:
3737
headers = {}
3838

39-
async with AsyncClient() as client:
39+
async with AsyncClient(timeout=30.0) as client:
4040
res = await client.get(url, params=query_params, headers=headers) # type:ignore
4141

4242
log_debug_message(
@@ -59,7 +59,7 @@ async def do_post_request(
5959
headers["content-type"] = "application/x-www-form-urlencoded"
6060
headers["accept"] = "application/json"
6161

62-
async with AsyncClient() as client:
62+
async with AsyncClient(timeout=30.0) as client:
6363
res = await client.post(url, data=body_params, headers=headers) # type:ignore
6464
log_debug_message(
6565
"Received response with status %s and body %s", res.status_code, res.text

0 commit comments

Comments
 (0)