Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: timeout #522

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.24.1] - 2024-08-16

- Sets time out for httpx client to 30s everywhere. - https://github.com/supertokens/supertokens-python/issues/516

## [0.24.0] - 2024-07-31

### Changes
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

setup(
name="supertokens_python",
version="0.24.0",
version="0.24.1",
author="SuperTokens",
license="Apache 2.0",
author_email="[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion supertokens_python/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from __future__ import annotations

SUPPORTED_CDI_VERSIONS = ["3.0"]
VERSION = "0.24.0"
VERSION = "0.24.1"
TELEMETRY = "/telemetry"
USER_COUNT = "/users/count"
USER_DELETE = "/user/remove"
Expand Down
2 changes: 1 addition & 1 deletion supertokens_python/querier.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async def api_request(
raise Exception("Retry request failed")

try:
async with AsyncClient() as client:
async with AsyncClient(timeout=30.0) as client:
if method == "GET":
return await client.get(url, *args, **kwargs) # type: ignore
if method == "POST":
Expand Down
2 changes: 1 addition & 1 deletion supertokens_python/recipe/dashboard/api/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async def handle_analytics_post(
data["telemetryId"] = telemetry_id

try:
async with AsyncClient() as client:
async with AsyncClient(timeout=30.0) as client:
await client.post( # type: ignore
url=TELEMETRY_SUPERTOKENS_API_URL,
json=data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def create_and_send_email_using_supertokens_service(
"passwordResetURL": password_reset_url_with_token,
}
try:
async with AsyncClient() as client:
async with AsyncClient(timeout=30.0) as client:
resp = await client.post("https://api.supertokens.io/0/st/auth/password/reset", json=data, headers={"api-version": "0"}) # type: ignore
resp.raise_for_status()
log_debug_message("Password reset email sent to %s", user.email)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def create_and_send_email_using_supertokens_service(
"emailVerifyURL": email_verification_url,
}
try:
async with AsyncClient() as client:
async with AsyncClient(timeout=30.0) as client:
resp = await client.post("https://api.supertokens.io/0/st/auth/email/verify", json=data, headers={"api-version": "0"}) # type: ignore
resp.raise_for_status()
log_debug_message("Email verification email sent to %s", user.email)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async def create_and_send_email_with_supertokens_service(
data["userInputCode"] = input_.user_input_code

try:
async with AsyncClient() as client:
async with AsyncClient(timeout=30.0) as client:
resp = await client.post("https://api.supertokens.io/0/st/auth/passwordless/login", json=data, headers={"api-version": "0"}) # type: ignore
resp.raise_for_status()
log_debug_message("Passwordless login email sent to %s", input_.email)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def create_and_send_sms_using_supertokens_service(
sms_input_json["urlWithLinkCode"] = input_.url_with_link_code

try:
async with AsyncClient() as client:
async with AsyncClient(timeout=30.0) as client:
res = await client.post( # type: ignore
SUPERTOKENS_SMS_SERVICE_URL,
json={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def send_sms(
if template_vars.user_input_code:
sms_input["userInputCode"] = template_vars.user_input_code
try:
async with AsyncClient() as client:
async with AsyncClient(timeout=30.0) as client:
await client.post( # type: ignore
SUPERTOKENS_SMS_SERVICE_URL,
json={
Expand Down
2 changes: 1 addition & 1 deletion supertokens_python/recipe/thirdparty/providers/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ async def verify_id_token_from_jwks_endpoint_and_get_payload(
id_token: str, jwks_uri: str, audience: str
):
public_keys: List[RSAAlgorithm] = []
async with AsyncClient() as client:
async with AsyncClient(timeout=30.0) as client:
response = await client.get(jwks_uri) # type:ignore
key_payload = response.json()
for key in key_payload["keys"]:
Expand Down
4 changes: 2 additions & 2 deletions supertokens_python/recipe/thirdparty/providers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def do_get_request(
if headers is None:
headers = {}

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

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

async with AsyncClient() as client:
async with AsyncClient(timeout=30.0) as client:
res = await client.post(url, data=body_params, headers=headers) # type:ignore
log_debug_message(
"Received response with status %s and body %s", res.status_code, res.text
Expand Down
Loading