Skip to content

Instantly share code, notes, and snippets.

@wshayes
Created May 31, 2019 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wshayes/537f54fb0129a4038dc3406ac55e4c96 to your computer and use it in GitHub Desktop.
Save wshayes/537f54fb0129a4038dc3406ac55e4c96 to your computer and use it in GitHub Desktop.
[FastAPI code samples] #fastapi
# Detecting multiple request methods
@app.api_route(methods=["PATCH", "POST"])
OR
@app.get('/profile')
@app.post('/profile')
async def profile(request: Request, api_key: str = Depends(get_api_key)):
if request.method == 'POST':
print('++++++++++++++')
print(api_key)
return templates.TemplateResponse('profile.html', {'request': request, 'api_key': api_key})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment