tutorial005_py310.py — fastapi Source File
Architecture documentation for tutorial005_py310.py, a python file in the fastapi codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 66858a25_944d_cbf6_b313_ab09e0ce6572["tutorial005_py310.py"] e973e384_8276_b242_eb98_1c0b79a84e68["datetime"] 66858a25_944d_cbf6_b313_ab09e0ce6572 --> e973e384_8276_b242_eb98_1c0b79a84e68 822acfd3_718b_c215_daf1_986b6791f3bd["jwt"] 66858a25_944d_cbf6_b313_ab09e0ce6572 --> 822acfd3_718b_c215_daf1_986b6791f3bd 534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"] 66858a25_944d_cbf6_b313_ab09e0ce6572 --> 534f6e44_61b8_3c38_8b89_6934a6df9802 35c4ea20_c454_5afd_6cda_f0818bbcc650["__init__.py"] 66858a25_944d_cbf6_b313_ab09e0ce6572 --> 35c4ea20_c454_5afd_6cda_f0818bbcc650 96400ec7_7fe7_41d2_404e_d92498b1ac31["jwt.exceptions"] 66858a25_944d_cbf6_b313_ab09e0ce6572 --> 96400ec7_7fe7_41d2_404e_d92498b1ac31 640a3b96_2dad_7fba_4cb0_187a74ec8604["pwdlib"] 66858a25_944d_cbf6_b313_ab09e0ce6572 --> 640a3b96_2dad_7fba_4cb0_187a74ec8604 6913fbd4_39df_d14b_44bb_522e99b65b90["pydantic"] 66858a25_944d_cbf6_b313_ab09e0ce6572 --> 6913fbd4_39df_d14b_44bb_522e99b65b90 style 66858a25_944d_cbf6_b313_ab09e0ce6572 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from datetime import datetime, timedelta, timezone
import jwt
from fastapi import Depends, FastAPI, HTTPException, Security, status
from fastapi.security import (
OAuth2PasswordBearer,
OAuth2PasswordRequestForm,
SecurityScopes,
)
from jwt.exceptions import InvalidTokenError
from pwdlib import PasswordHash
from pydantic import BaseModel, ValidationError
# to get a string like this run:
# openssl rand -hex 32
SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7"
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 30
fake_users_db = {
"johndoe": {
"username": "johndoe",
"full_name": "John Doe",
"email": "johndoe@example.com",
"hashed_password": "$argon2id$v=19$m=65536,t=3,p=4$wagCPXjifgvUFBzq4hqe3w$CYaIb8sB+wtD+Vu/P4uod1+Qof8h+1g7bbDlBID48Rc",
"disabled": False,
},
"alice": {
"username": "alice",
"full_name": "Alice Chains",
"email": "alicechains@example.com",
"hashed_password": "$argon2id$v=19$m=65536,t=3,p=4$g2/AV1zwopqUntPKJavBFw$BwpRGDCyUHLvHICnwijyX8ROGoiUPwNKZ7915MeYfCE",
"disabled": True,
},
}
class Token(BaseModel):
access_token: str
token_type: str
class TokenData(BaseModel):
username: str | None = None
scopes: list[str] = []
class User(BaseModel):
username: str
email: str | None = None
full_name: str | None = None
disabled: bool | None = None
class UserInDB(User):
hashed_password: str
password_hash = PasswordHash.recommended()
// ... (117 more lines)
Domain
Subdomains
Functions
Dependencies
- __init__.py
- __init__.py
- datetime
- jwt
- jwt.exceptions
- pwdlib
- pydantic
Source
Frequently Asked Questions
What does tutorial005_py310.py do?
tutorial005_py310.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Routing subdomain.
What functions are defined in tutorial005_py310.py?
tutorial005_py310.py defines 11 function(s): authenticate_user, create_access_token, get_current_active_user, get_current_user, get_password_hash, get_user, login_for_access_token, read_own_items, read_system_status, read_users_me, and 1 more.
What does tutorial005_py310.py depend on?
tutorial005_py310.py imports 7 module(s): __init__.py, __init__.py, datetime, jwt, jwt.exceptions, pwdlib, pydantic.
Where is tutorial005_py310.py in the architecture?
tutorial005_py310.py is located at docs_src/security/tutorial005_py310.py (domain: FastAPI, subdomain: Routing, directory: docs_src/security).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free