Commit 330d5eb3 authored by Saci Pererê's avatar Saci Pererê :speech_balloon:
Browse files

chore: Muda forma de declarar "type OU None"

Showing with 7 additions and 2 deletions
+7 -2
#!/usr/bin/env python3
from typing import Union
from pydantic import BaseModel
......@@ -8,4 +10,4 @@ class Token(BaseModel):
class TokenData(BaseModel):
username: str | None = None
username: Union[str, None] = None
#!/usr/bin/env python3
from datetime import datetime, timedelta, timezone
from typing import Union
from fastapi.security import OAuth2PasswordBearer
from jose import jwt
......@@ -19,7 +20,9 @@ def get_password_hash(password):
return pwd_context.hash(password)
def create_access_token(data: dict, expires_delta: timedelta | None = None):
def create_access_token(
data: dict, expires_delta: Union[timedelta, None] = None
):
to_encode = data.copy()
if expires_delta:
expire = datetime.now(timezone.utc) + expires_delta
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment