Spaces:
Sleeping
Sleeping
File size: 496 Bytes
4f9ea63 98fc1c9 4f9ea63 98fc1c9 4f9ea63 98fc1c9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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": ""}
|