from fastapi import FastAPI from fastapi.staticfiles import StaticFiles from pydantic import BaseModel from pydantic import Field app = FastAPI() class Data(BaseModel): string: str member_secret: str class ItemOut(BaseModel): status: str file: str @app.get("/") def index(): if data.member_secret != "" and data.member_secret == os.environ.get("MEMBER_SECRET"): return {"status": "OK", "file": "hello world!"} else: return {"status": "SORRY! This file is member only.", "file": ""}