Этот коммит содержится в:
Vlad Pronsky 2024-06-29 16:21:42 +03:00
родитель 489e362e8c
Коммит 8acfe41bba
2 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -28,7 +28,7 @@ dependencies = [
[project.optional-dependencies]
dev = [
"pyright>=1.1.359",
"pyright>=1.1.369",
"pytest-asyncio>=0.23.3",
"pytest-cov>=4.1.0",
"pytest-httpx>=0.28.0",

Просмотреть файл

@ -7,8 +7,15 @@ from datetime import datetime
from .logger import logger
TWS_WAIT_EMAIL_CODE = [os.getenv("TWS_WAIT_EMAIL_CODE"), os.getenv("LOGIN_CODE_TIMEOUT"), 30]
TWS_WAIT_EMAIL_CODE = [int(x) for x in TWS_WAIT_EMAIL_CODE if x is not None][0]
def env_int(key: str | list[str], default: int) -> int:
key = [key] if isinstance(key, str) else key
val = [os.getenv(k) for k in key]
val = [int(x) for x in val if x is not None]
return val[0] if val else default
TWS_WAIT_EMAIL_CODE = env_int(["TWS_WAIT_EMAIL_CODE", "LOGIN_CODE_TIMEOUT"], 30)
class EmailLoginError(Exception):