mirror of
https://github.com/markbeep/AudioBookRequest.git
synced 2026-01-07 06:00:04 -06:00
simplify exp check
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from math import inf
|
||||
import time
|
||||
from typing import Annotated, Optional
|
||||
|
||||
@@ -154,9 +155,8 @@ class ABRAuth:
|
||||
request: Request,
|
||||
session: Session,
|
||||
) -> User:
|
||||
if exp := request.session.get("exp"):
|
||||
if exp < time.time():
|
||||
raise RequiresLoginException()
|
||||
if request.session.get("exp", inf) < time.time():
|
||||
raise RequiresLoginException()
|
||||
return await self._get_session_auth(request, session)
|
||||
|
||||
async def _get_none_auth(self, session: Session) -> User:
|
||||
|
||||
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.pyright]
|
||||
include = ["**/*.py"]
|
||||
exclude = ["**/__pycache__", "**/.venv"]
|
||||
exclude = ["**/__pycache__", "**/.venv", "**/.direnv"]
|
||||
ignore = []
|
||||
|
||||
typeCheckingMode = "strict"
|
||||
|
||||
Reference in New Issue
Block a user