Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1351 - 1360 of 1,977 for Fastapi (0.05 sec)

  1. tests/test_tutorial/test_schema_extra_example/test_tutorial001_py310.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310, needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.schema_extra_example.tutorial001_py310 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py310
    @needs_pydanticv2
    def test_post_body_example(client: TestClient):
        response = client.put(
            "/items/5",
            json={
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 4.7K bytes
    - Viewed (0)
  2. docs/zh/docs/tutorial/index.md

    ```
    
    </div>
    
    强烈建议你在本地编写或复制代码,对其进行编辑并运行。
    
    在编辑器中使用 FastAPI 会真正地展现出它的优势:只需要编写很少的代码,所有的类型检查,代码补全等等。
    
    ---
    
    ## 安装 FastAPI
    
    第一个步骤是安装 FastAPI。
    
    为了使用本教程,你可能需要安装所有的可选依赖及对应功能:
    
    <div class="termy">
    
    ```console
    $ pip install "fastapi[all]"
    
    ---> 100%
    ```
    
    </div>
    
    ......以上安装还包括了 `uvicorn`,你可以将其用作运行代码的服务器。
    
    /// note
    
    你也可以分开来安装。
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Aug 06 04:48:30 UTC 2024
    - 2.4K bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/encoder.md

    There are some cases where you might need to convert a data type (like a Pydantic model) to something compatible with JSON (like a `dict`, `list`, etc).
    
    For example, if you need to store it in a database.
    
    For that, **FastAPI** provides a `jsonable_encoder()` function.
    
    ## Using the `jsonable_encoder`
    
    Let's imagine that you have a database `fake_db` that only receives JSON compatible data.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 23:31:16 UTC 2024
    - 1.6K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client() -> TestClient:
        from docs_src.separate_openapi_schemas.tutorial001 import app
    
        client = TestClient(app)
        return client
    
    
    def test_create_item(client: TestClient) -> None:
        response = client.post("/items/", json={"name": "Foo"})
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Sep 28 04:14:40 UTC 2023
    - 4.8K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001_py39.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39, needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client() -> TestClient:
        from docs_src.separate_openapi_schemas.tutorial001_py39 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_create_item(client: TestClient) -> None:
        response = client.post("/items/", json={"name": "Foo"})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Sep 28 04:14:40 UTC 2023
    - 4.9K bytes
    - Viewed (0)
  6. docs/pt/docs/how-to/testing-database.md

    Aqui tem um mini <a href="https://sqlmodel.tiangolo.com/tutorial/fastapi/" class="external-link" target="_blank">tutorial de como usar SQLModel com FastAPI</a>. ✨
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Oct 18 12:04:04 UTC 2024
    - 547 bytes
    - Viewed (0)
  7. docs_src/dependencies/tutorial008d_an_py39.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException
    
    app = FastAPI()
    
    
    class InternalError(Exception):
        pass
    
    
    def get_username():
        try:
            yield "Rick"
        except InternalError:
            print("We don't swallow the internal error here, we raise again 😎")
            raise
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 734 bytes
    - Viewed (0)
  8. docs_src/dependencies/tutorial012_an_py39.py

    from fastapi import Depends, FastAPI, Header, HTTPException
    from typing_extensions import Annotated
    
    
    async def verify_token(x_token: Annotated[str, Header()]):
        if x_token != "fake-super-secret-token":
            raise HTTPException(status_code=400, detail="X-Token header invalid")
    
    
    async def verify_key(x_key: Annotated[str, Header()]):
        if x_key != "fake-super-secret-key":
            raise HTTPException(status_code=400, detail="X-Key header invalid")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 756 bytes
    - Viewed (0)
  9. docs_src/path_operation_configuration/tutorial004_py310.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
        tags: set[str] = set()
    
    
    @app.post("/items/", response_model=Item, summary="Create an item")
    async def create_item(item: Item):
        """
        Create an item with all the information:
    
        - **name**: each item must have a name
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 638 bytes
    - Viewed (0)
  10. .github/labeler.yml

            - docs_src/**
          - all-globs-to-all-files:
            - '!fastapi/**'
            - '!pyproject.toml'
            - '!docs/en/data/sponsors.yml'
            - '!docs/en/overrides/main.html'
    
    lang-all:
      - all:
        - changed-files:
          - any-glob-to-any-file:
            - docs/*/docs/**
          - all-globs-to-all-files:
            - '!docs/en/docs/**'
            - '!fastapi/**'
            - '!pyproject.toml'
    
    internal:
      - all:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 31 10:18:37 UTC 2024
    - 892 bytes
    - Viewed (0)
Back to top