Fastapi: Manager

Created on 27 Sep 2020  路  1Comment  路  Source: tiangolo/fastapi

yes good ### First check

  • [ ] I added a very descriptive title to this issue.
  • [ ] I used the GitHub search to find a similar issue and didn't find it.
  • [x] I searched the FastAPI documentation, with the integrated search.
  • [ ] I already searched in Google "How to X in FastAPI" and didn't find any information.
  • [x] I already read and followed all the tutorial in the docs and didn't find an answer.
  • [ ] I already checked if it is not related to FastAPI but to Pydantic.
  • [ ] I already checked if it is not related to FastAPI but to Swagger UI.
  • [ ] I already checked if it is not related to FastAPI but to ReDoc.
  • [ ] After submitting this, I commit to:

    • Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there.

    • Or, I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask questions in the future.

    • Implement a Pull Request for a confirmed bug.

Example

Here's a self-contained minimal, reproducible, example with my use case:

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
def read_root():
    return {"Hello": "World"}

Description

  • Open the browser and call the endpoint /.
  • It returns a JSON with {"Hello": "World"}.
  • I would like it to have an extra parameter to teleport me to the moon and back.

The solution you would like

I would like it to have a teleport_to_moon parameter that defaults to False, and can be set to True to teleport me:

from fastapi import FastAPI

app = FastAPI()


@app.get("/", teleport_to_moon=True)
def read_root():
    return {"Hello": "World"}

Describe alternatives you've considered

To wait for Space X moon travel plans to drop down long after they release them. But I would rather teleport.

Environment

  • OS: [e.g. Linux / Windows / macOS]:
  • FastAPI Version [e.g. 0.3.0]:

To know the FastAPI version use:

python -c "import fastapi; print(fastapi.__version__)"
  • Python version:

To know the Python version use:

python --version

Additional context

enhancement

Most helpful comment

giphy

>All comments

giphy

Was this page helpful?
0 / 5 - 0 ratings