Skip to content

Instantly share code, notes, and snippets.

@naxty
Created August 6, 2019 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naxty/df936ed23f33f68e594e586cd4ad3adf to your computer and use it in GitHub Desktop.
Save naxty/df936ed23f33f68e594e586cd4ad3adf to your computer and use it in GitHub Desktop.
Example of fast api post request
from fastapi import APIRouter, Depends
api = APIRouter()
@api.post("/predict", response_model=PredictionResult)
def post_predict(
housing_features: HousingFeatures,
authenticated: bool = Depends(security.validate_request),
):
assert authenticated == True
return predict(housing_features)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment