Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 129 for main (0.15 sec)

  1. tests/main.py

    @app.get("/path/param-minlength/{item_id}")
    def get_path_param_min_length(item_id: str = Path(min_length=3)):
        return item_id
    
    
    @app.get("/path/param-maxlength/{item_id}")
    def get_path_param_max_length(item_id: str = Path(max_length=3)):
        return item_id
    
    
    @app.get("/path/param-min_maxlength/{item_id}")
    def get_path_param_min_max_length(item_id: str = Path(max_length=3, min_length=2)):
        return item_id
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 4.3K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_bigger_applications/test_main.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.bigger_applications.app.main import app
    
        client = TestClient(app)
        return client
    
    
    def test_users_token_jessica(client: TestClient):
        response = client.get("/users?token=jessica")
        assert response.status_code == 200
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.6K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_bigger_applications/test_main_an.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.bigger_applications.app_an.main import app
    
        client = TestClient(app)
        return client
    
    
    def test_users_token_jessica(client: TestClient):
        response = client.get("/users?token=jessica")
        assert response.status_code == 200
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.6K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_bigger_applications/test_main_an_py39.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.bigger_applications.app_an_py39.main import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_users_token_jessica(client: TestClient):
        response = client.get("/users?token=jessica")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.9K bytes
    - Viewed (0)
  5. tests/test_dependency_overrides.py

                ]
            }
        )
    
    
    def test_main_depends_q_foo():
        response = client.get("/main-depends/?q=foo")
        assert response.status_code == 200
        assert response.json() == {
            "in": "main-depends",
            "params": {"q": "foo", "skip": 0, "limit": 100},
        }
    
    
    def test_main_depends_q_foo_skip_100_limit_200():
        response = client.get("/main-depends/?q=foo&skip=100&limit=200")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 15.4K bytes
    - Viewed (0)
  6. docs/en/docs/tutorial/bigger-applications.md

    ## The main `FastAPI`
    
    Now, let's see the module at `app/main.py`.
    
    Here's where you import and use the class `FastAPI`.
    
    This will be the main file in your application that ties everything together.
    
    And as most of your logic will now live in its own specific module, the main file will be quite simple.
    
    ### Import `FastAPI`
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  7. docs/ru/docs/tutorial/debugging.md

    В вашем FastAPI приложении, импортируйте и вызовите `uvicorn` напрямую:
    
    ```Python hl_lines="1  15"
    {!../../../docs_src/debugging/tutorial001.py!}
    ```
    
    ### Описание `__name__ == "__main__"`
    
    Главная цель использования `__name__ == "__main__"` в том, чтобы код выполнялся при запуске файла с помощью:
    
    <div class="termy">
    
    ```console
    $ python myapp.py
    ```
    
    </div>
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  8. docs/en/docs/advanced/sub-applications.md

    ```Python hl_lines="11  19"
    {!../../../docs_src/sub_applications/tutorial001.py!}
    ```
    
    ### Check the automatic API docs
    
    Now, run `uvicorn` with the main app, if your file is `main.py`, it would be:
    
    <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)
    ```
    
    </div>
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 2.9K bytes
    - Viewed (0)
  9. docs/zh/docs/tutorial/bigger-applications.md

    因此,为了能够在同一个文件中使用它们,我们直接导入子模块:
    
    ```Python hl_lines="5" title="app/main.py"
    {!../../../docs_src/bigger_applications/app/main.py!}
    ```
    
    ### 包含 `users` 和 `items` 的 `APIRouter`
    
    现在,让我们来包含来自 `users` 和 `items` 子模块的 `router`。
    
    ```Python hl_lines="10-11" title="app/main.py"
    {!../../../docs_src/bigger_applications/app/main.py!}
    ```
    
    !!! info
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 18.5K bytes
    - Viewed (0)
  10. docs/en/docs/advanced/settings.md

    ### The main app file
    
    Now we create a dependency that returns a new `config.Settings()`.
    
    === "Python 3.9+"
    
        ```Python hl_lines="6  12-13"
        {!> ../../../docs_src/settings/app02_an_py39/main.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="6  12-13"
        {!> ../../../docs_src/settings/app02_an/main.py!}
        ```
    
    === "Python 3.8+ non-Annotated"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 15.7K bytes
    - Viewed (0)
Back to top