Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1111 - 1120 of 2,000 for Fastapi (0.1 sec)

  1. tests/test_tutorial/test_dependencies/test_tutorial008c.py

    import pytest
    from fastapi.exceptions import FastAPIError
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.dependencies.tutorial008c import app
    
        client = TestClient(app)
        return client
    
    
    def test_get_no_item(client: TestClient):
        response = client.get("/items/foo")
        assert response.status_code == 404, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  2. docs/ja/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
    - 3.3K bytes
    - Viewed (0)
  3. tests/test_param_in_path_and_dependency.py

    from fastapi import Depends, FastAPI
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    async def user_exists(user_id: int):
        return True
    
    
    @app.get("/users/{user_id}", dependencies=[Depends(user_exists)])
    async def read_users(user_id: int):
        pass
    
    
    client = TestClient(app)
    
    
    def test_read_users():
        response = client.get("/users/42")
        assert response.status_code == 200, response.text
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  4. docs_src/sql_databases/tutorial001.py

    from typing import List, Union
    
    from fastapi import Depends, FastAPI, HTTPException, Query
    from sqlmodel import Field, Session, SQLModel, create_engine, select
    
    
    class Hero(SQLModel, table=True):
        id: Union[int, None] = Field(default=None, primary_key=True)
        name: str = Field(index=True)
        age: Union[int, None] = Field(default=None, index=True)
        secret_name: str
    
    
    sqlite_file_name = "database.db"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  5. docs_src/sql_databases/tutorial001_py310.py

    from fastapi import Depends, FastAPI, HTTPException, Query
    from sqlmodel import Field, Session, SQLModel, create_engine, select
    
    
    class Hero(SQLModel, table=True):
        id: int | None = Field(default=None, primary_key=True)
        name: str = Field(index=True)
        age: int | None = Field(default=None, index=True)
        secret_name: str
    
    
    sqlite_file_name = "database.db"
    sqlite_url = f"sqlite:///{sqlite_file_name}"
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  6. docs/de/docs/tutorial/bigger-applications.md

    ///
    
    ## Das Haupt-`FastAPI`.
    
    Sehen wir uns nun das Modul unter `app/main.py` an.
    
    Hier importieren und verwenden Sie die Klasse `FastAPI`.
    
    Dies ist die Hauptdatei Ihrer Anwendung, die alles zusammen bindet.
    
    Und da sich der Großteil Ihrer Logik jetzt in seinem eigenen spezifischen Modul befindet, wird die Hauptdatei recht einfach sein.
    
    ### `FastAPI` importieren
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 21K bytes
    - Viewed (0)
  7. docs/pt/docs/tutorial/response-status-code.md

    <img src="/img/tutorial/response-status-code/image02.png">
    
    /// note | "Detalhes técnicos"
    
    Você também pode usar `from starlette import status`.
    
    **FastAPI** fornece o mesmo `starlette.status` como `fastapi.status` apenas como uma conveniência para você, o desenvolvedor. Mas vem diretamente da Starlette.
    
    ///
    
    ## Alterando o padrão
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 4.3K bytes
    - Viewed (0)
  8. docs/fr/docs/tutorial/path-params.md

    Comme vous l'avez remarqué, la valeur reçue par la fonction (et renvoyée ensuite) est `3`,
    en tant qu'entier (`int`) Python, pas la chaîne de caractères (`string`) `"3"`.
    
    Grâce aux déclarations de types, **FastAPI** fournit du
    <abbr title="conversion de la chaîne de caractères venant de la requête HTTP en données Python">"parsing"</abbr> automatique.
    
    ///
    
    ## Validation de données
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 10K bytes
    - Viewed (0)
  9. docs/pt/docs/tutorial/request-forms.md

    Ex: `pip install python-multipart`.
    
    ///
    
    ## Importe `Form`
    
    Importe `Form` de `fastapi`:
    
    ```Python hl_lines="1"
    {!../../docs_src/request_forms/tutorial001.py!}
    ```
    
    ## Declare parâmetros de `Form`
    
    Crie parâmetros de formulário da mesma forma que você faria para `Body` ou `Query`:
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 2.7K bytes
    - Viewed (0)
  10. docs/zh/docs/advanced/advanced-dependencies.md

    为此,需要声明 `__call__` 方法:
    
    ```Python hl_lines="10"
    {!../../docs_src/dependencies/tutorial011.py!}
    ```
    
    本例中,**FastAPI**  使用 `__call__` 检查附加参数及子依赖项,稍后,还要调用它向*路径操作函数*传递值。
    
    ## 参数化实例
    
    接下来,使用 `__init__` 声明用于**参数化**依赖项的实例参数:
    
    ```Python hl_lines="7"
    {!../../docs_src/dependencies/tutorial011.py!}
    ```
    
    本例中,**FastAPI** 不使用 `__init__`,我们要直接在代码中使用。
    
    ## 创建实例
    
    使用以下代码创建类实例:
    
    ```Python hl_lines="16"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 2K bytes
    - Viewed (0)
Back to top