-
-
Save francbartoli/6182af1324d99ce1d7dfab0d0401aac1 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