Search Options

Results per page
Sort
Preferred Languages
Advance

Results 111 - 120 of 1,976 for Fastapi (0.05 sec)

  1. docs_src/custom_request_and_route/tutorial002.py

    from typing import Callable, List
    
    from fastapi import Body, FastAPI, HTTPException, Request, Response
    from fastapi.exceptions import RequestValidationError
    from fastapi.routing import APIRoute
    
    
    class ValidationErrorLoggingRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                try:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 932 bytes
    - Viewed (0)
  2. docs/zh-hant/docs/tutorial/index.md

    **強烈建議**你編寫或複製程式碼、進行修改並在本地端運行。
    
    在編輯器中使用它,才能真正體會到 FastAPI 的好處,可以看到你只需編寫少量程式碼,以及所有的型別檢查、自動補齊等功能。
    
    ---
    
    ## 安裝 FastAPI
    
    第一步是安裝 FastAPI。
    
    確保你建立一個[虛擬環境](../virtual-environments.md){.internal-link target=_blank},啟用它,然後**安裝 FastAPI**:
    
    <div class="termy">
    
    ```console
    $ pip install "fastapi[standard]"
    
    ---> 100%
    ```
    
    </div>
    
    /// note
    
    當你使用 `pip install "fastapi[standard]"` 安裝時,會包含一些預設的可選標準相依項。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Oct 24 18:28:00 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  3. docs/fr/docs/deployment/docker.md

    ```Dockerfile
    FROM python:3.7
    
    RUN pip install fastapi uvicorn
    
    EXPOSE 80
    
    COPY ./app /app
    
    CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
    ```
    
    ## Créer le code **FastAPI**.
    
    * Créer un répertoire `app` et y entrer.
    * Créez un fichier `main.py` avec :
    
    ```Python
    from typing import Optional
    
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    def read_root():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Aug 06 04:48:30 UTC 2024
    - 7.5K bytes
    - Viewed (0)
  4. docs/zh/docs/project-generation.md

    # FastAPI全栈模板
    
    模板通常带有特定的设置,而且被设计为灵活和可定制的。这允许您根据项目的需求修改和调整它们,使它们成为一个很好的起点。🏁
    
    您可以使用此模板开始,因为它包含了许多已经为您完成的初始设置、安全性、数据库和一些API端点。
    
    代码仓: <a href="https://github.com/fastapi/full-stack-fastapi-template" class="external-link" target="_blank">Full Stack FastAPI Template</a>
    
    ## FastAPI全栈模板 - 技术栈和特性
    
    - ⚡ [**FastAPI**](https://fastapi.tiangolo.com) 用于Python后端API.
        - 🧰 [SQLModel](https://sqlmodel.tiangolo.com) 用于Python和SQL数据库的集成(ORM)。
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Oct 04 11:16:34 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  5. tests/test_empty_router.py

    import pytest
    from fastapi import APIRouter, FastAPI
    from fastapi.exceptions import FastAPIError
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    router = APIRouter()
    
    
    @router.get("")
    def get_empty():
        return ["OK"]
    
    
    app.include_router(router, prefix="/prefix")
    
    
    client = TestClient(app)
    
    
    def test_use_empty():
        with client:
            response = client.get("/prefix")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Jun 11 22:37:34 UTC 2023
    - 805 bytes
    - Viewed (0)
  6. tests/test_router_redirect_slashes.py

    from fastapi import APIRouter, FastAPI
    from fastapi.testclient import TestClient
    
    
    def test_redirect_slashes_enabled():
        app = FastAPI()
        router = APIRouter()
    
        @router.get("/hello/")
        def hello_page() -> str:
            return "Hello, World!"
    
        app.include_router(router)
    
        client = TestClient(app)
    
        response = client.get("/hello/", follow_redirects=False)
        assert response.status_code == 200
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Jun 22 10:37:50 UTC 2023
    - 974 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_websockets/test_tutorial002_an_py39.py

    import pytest
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from fastapi.websockets import WebSocketDisconnect
    
    from ...utils import needs_py39
    
    
    @pytest.fixture(name="app")
    def get_app():
        from docs_src.websockets.tutorial002_an_py39 import app
    
        return app
    
    
    @needs_py39
    def test_main(app: FastAPI):
        client = TestClient(app)
        response = client.get("/")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 3.9K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_events/test_tutorial001.py

    import pytest
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="app", scope="module")
    def get_app():
        with pytest.warns(DeprecationWarning):
            from docs_src.events.tutorial001 import app
        yield app
    
    
    def test_events(app: FastAPI):
        with TestClient(app) as client:
            response = client.get("/items/foo")
            assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 18 12:36:40 UTC 2023
    - 3.6K bytes
    - Viewed (0)
  9. tests/test_security_api_key_cookie_optional.py

    from typing import Optional
    
    from fastapi import Depends, FastAPI, Security
    from fastapi.security import APIKeyCookie
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    api_key = APIKeyCookie(name="key", auto_error=False)
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: Optional[str] = Security(api_key)):
        if oauth_header is None:
            return None
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  10. tests/test_security_api_key_query_optional.py

    from typing import Optional
    
    from fastapi import Depends, FastAPI, Security
    from fastapi.security import APIKeyQuery
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    api_key = APIKeyQuery(name="key", auto_error=False)
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: Optional[str] = Security(api_key)):
        if oauth_header is None:
            return None
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2K bytes
    - Viewed (0)
Back to top