Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. app = FastAPI(docs_url=None, redoc_url=None, openapi_url=None)
  2.  
  3. @app.get("/")
  4. async def homepage():
  5. return "Welcome to the security test!"
  6.  
  7. @app.get("/openapi.json")
  8. async def get_open_api_endpoint(current_user: User = Depends(get_current_active_user)):
  9. return JSONResponse(get_openapi(title="FastAPI", version=1, routes=app.routes))
  10.  
  11.  
  12. @app.get("/docs")
  13. async def get_documentation(current_user: User = Depends(get_current_active_user)):
  14. return get_swagger_ui_html(openapi_url="/openapi.json", title="docs")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement