From 878c0dc2169d4cb1b172edc22ac0a26bb0404579 Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 17 Oct 2023 18:22:05 +0300 Subject: [PATCH] timeout,ruff --- pyproject.toml | 11 +++++++++++ services/auth.py | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 30fd568..d974101 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ itsdangerous = "^2.1.2" [tool.poetry.dev-dependencies] pytest = "^7.4.2" black = { version = "^23.9.1", python = ">=3.12" } +ruff = { version = "^0.1.0", python = ">=3.12" } [tool.black] line-length = 120 @@ -53,3 +54,13 @@ force_grid_wrap = 0 use_parentheses = true ensure_newline_before_comments = true line_length = 120 + + +[tool.ruff] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] +line-length = 120 +target-version = "py312" \ No newline at end of file diff --git a/services/auth.py b/services/auth.py index 5c93d5f..9af880b 100644 --- a/services/auth.py +++ b/services/auth.py @@ -4,7 +4,7 @@ from httpx import AsyncClient, HTTPError from settings import AUTH_URL -INTERNAL_AUTH_SERVER = "v2.discours" in AUTH_URL or "testapi.discours" in AUTH_URL +INTERNAL_AUTH_SERVER = "auth.discours.io" not in AUTH_URL async def check_auth(req): @@ -23,7 +23,7 @@ async def check_auth(req): "variables": None, } - async with AsyncClient() as client: + async with AsyncClient(timeout=30.0) as client: response = await client.post(AUTH_URL, headers=headers, json=gql) print(f"[services.auth] response: {response.status_code} {response.text}") if response.status_code != 200: