Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /fastapi-users_fastapi-users /examples /sqlalchemy-oauth /app /app.py
| from contextlib import asynccontextmanager | |
| from fastapi import Depends, FastAPI | |
| from app.db import User, create_db_and_tables | |
| from app.schemas import UserCreate, UserRead, UserUpdate | |
| from app.users import ( | |
| SECRET, | |
| auth_backend, | |
| current_active_user, | |
| fastapi_users, | |
| google_oauth_client, | |
| ) | |
| async def lifespan(app: FastAPI): | |
| # Not needed if you setup a migration system like Alembic | |
| await create_db_and_tables() | |
| yield | |
| app = FastAPI(lifespan=lifespan) | |
| app.include_router( | |
| fastapi_users.get_auth_router(auth_backend), prefix="/auth/jwt", tags=["auth"] | |
| ) | |
| app.include_router( | |
| fastapi_users.get_register_router(UserRead, UserCreate), | |
| prefix="/auth", | |
| tags=["auth"], | |
| ) | |
| app.include_router( | |
| fastapi_users.get_reset_password_router(), | |
| prefix="/auth", | |
| tags=["auth"], | |
| ) | |
| app.include_router( | |
| fastapi_users.get_verify_router(UserRead), | |
| prefix="/auth", | |
| tags=["auth"], | |
| ) | |
| app.include_router( | |
| fastapi_users.get_users_router(UserRead, UserUpdate), | |
| prefix="/users", | |
| tags=["users"], | |
| ) | |
| app.include_router( | |
| fastapi_users.get_oauth_router(google_oauth_client, auth_backend, SECRET), | |
| prefix="/auth/google", | |
| tags=["auth"], | |
| ) | |
| async def authenticated_route(user: User = Depends(current_active_user)): | |
| return {"message": f"Hello {user.email}!"} | |
Xet Storage Details
- Size:
- 1.38 kB
- Xet hash:
- ffbb4d902240ae561ce37496bb506c4d4d85a68ed6220aa5d682e0f468a9768e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.