Created
May 31, 2019 14:21
-
-
Save wshayes/537f54fb0129a4038dc3406ac55e4c96 to your computer and use it in GitHub Desktop.
[FastAPI code samples] #fastapi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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