Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 74 for smart (0.15 sec)

  1. docs/en/docs/tutorial/query-params.md

        {!> ../../../docs_src/query_params/tutorial002.py!}
        ```
    
    In this case, the function parameter `q` will be optional, and will be `None` by default.
    
    !!! check
        Also notice that **FastAPI** is smart enough to notice that the path parameter `item_id` is a path parameter and `q` is not, so, it's a query parameter.
    
    ## Query parameter type conversion
    
    You can also declare `bool` types, and they will be converted:
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Oct 20 09:08:42 GMT 2023
    - 5.1K bytes
    - Viewed (0)
  2. fastapi/routing.py

                lifespan=lifespan,
            )
            if prefix:
                assert prefix.startswith("/"), "A path prefix must start with '/'"
                assert not prefix.endswith(
                    "/"
                ), "A path prefix must not end with '/', as the routes will start with '/'"
            self.prefix = prefix
            self.tags: List[Union[str, Enum]] = tags or []
            self.dependencies = list(dependencies or [])
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 170.1K bytes
    - Viewed (0)
  3. fastapi/applications.py

            app = FastAPI()
    
    
            @app.middleware("http")
            async def add_process_time_header(request: Request, call_next):
                start_time = time.time()
                response = await call_next(request)
                process_time = time.time() - start_time
                response.headers["X-Process-Time"] = str(process_time)
                return response
            ```
            """
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 172.2K bytes
    - Viewed (0)
  4. docs/en/docs/tutorial/response-model.md

    ```Python hl_lines="3  5-6"
    {
        "name": "Baz",
        "description": None,
        "price": 50.2,
        "tax": 10.5,
        "tags": []
    }
    ```
    
    FastAPI is smart enough (actually, Pydantic is smart enough) to realize that, even though `description`, `tax`, and `tags` have the same values as the defaults, they were set explicitly (instead of taken from the defaults).
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 17.9K bytes
    - Viewed (0)
  5. docs/en/docs/async.md

    As you are sitting at the table with your crush, while you wait for the burgers, you can spend that time admiring how awesome, cute and smart your crush is ✨😍✨.
    
    <img src="/img/async/concurrent-burgers/concurrent-burgers-05.png" class="illustration">
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 23K bytes
    - Viewed (0)
  6. docs_src/extra_data_types/tutorial001_an_py310.py

    async def read_items(
        item_id: UUID,
        start_datetime: Annotated[datetime, Body()],
        end_datetime: Annotated[datetime, Body()],
        process_after: Annotated[timedelta, Body()],
        repeat_at: Annotated[time | None, Body()] = None,
    ):
        start_process = start_datetime + process_after
        duration = end_datetime - start_process
        return {
            "item_id": item_id,
            "start_datetime": start_datetime,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 00:11:40 GMT 2024
    - 788 bytes
    - Viewed (0)
  7. docs_src/extra_data_types/tutorial001_an.py

    async def read_items(
        item_id: UUID,
        start_datetime: Annotated[datetime, Body()],
        end_datetime: Annotated[datetime, Body()],
        process_after: Annotated[timedelta, Body()],
        repeat_at: Annotated[Union[time, None], Body()] = None,
    ):
        start_process = start_datetime + process_after
        duration = end_datetime - start_process
        return {
            "item_id": item_id,
            "start_datetime": start_datetime,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 00:11:40 GMT 2024
    - 830 bytes
    - Viewed (0)
  8. docs/en/docs/advanced/events.md

    ## Use Case
    
    Let's start with an example **use case** and then see how to solve it with this.
    
    Let's imagine that you have some **machine learning models** that you want to use to handle requests. 🤖
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  9. scripts/docs.py

        frontmatter_end = match_pre.end()
        pre_end = match_start.end()
        post_start = match_end.start()
        template = Template(index_sponsors_template)
        message = template.render(sponsors=sponsors)
        pre_content = content[frontmatter_end:pre_end]
        post_content = content[post_start:]
        new_content = pre_content + message + post_content
        return new_content
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Jan 22 19:26:14 GMT 2024
    - 10.9K bytes
    - Viewed (1)
  10. docs/en/docs/tutorial/index.md

    ## Run the code
    
    All the code blocks can be copied and used directly (they are actually tested Python files).
    
    To run any of the examples, copy the code to a file `main.py`, and start `uvicorn` with:
    
    <div class="termy">
    
    ```console
    $ uvicorn main:app --reload
    
    <span style="color: green;">INFO</span>:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Jun 24 14:47:15 GMT 2023
    - 2.5K bytes
    - Viewed (0)
Back to top