Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 151 - 160 of 2,086 for FastAPI (0.1 seconds)

  1. tests/test_security_oauth2_authorization_code_bearer.py

    from fastapi import FastAPI, Security
    from fastapi.security import OAuth2AuthorizationCodeBearer
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2AuthorizationCodeBearer(
        authorizationUrl="authorize", tokenUrl="token", auto_error=True
    )
    
    
    @app.get("/items/")
    async def read_items(token: str | None = Security(oauth2_scheme)):
        return {"token": token}
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 2.7K bytes
    - Click Count (0)
  2. docs/zh-hant/docs/advanced/behind-a-proxy.md

    當以 `--forwarded-allow-ips` 設定好 FastAPI CLI 後,它會信任並使用這些標頭,例如在重新導向時產生正確的 URL。
    
    ## 具有移除路徑前綴的代理 { #proxy-with-a-stripped-path-prefix }
    
    你可能會有一個會為你的應用加入路徑前綴的代理。
    
    在這些情況下,你可以使用 `root_path` 來設定你的應用。
    
    `root_path` 是 ASGI 規格(FastAPI 透過 Starlette 所遵循的規格)所提供的機制。
    
    `root_path` 用來處理這些特定情境。
    
    在掛載子應用時,內部也會使用它。
    
    這種「具有移除路徑前綴的代理」情況,代表你在程式碼中宣告了 `/app` 的路徑,但你在上面又加了一層(代理),把你的 FastAPI 應用放在像是 `/api/v1` 這樣的路徑底下。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 15.3K bytes
    - Click Count (0)
  3. docs_src/security/tutorial006_an_py310.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
    app = FastAPI()
    
    security = HTTPBasic()
    
    
    @app.get("/users/me")
    def read_current_user(credentials: Annotated[HTTPBasicCredentials, Depends(security)]):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 361 bytes
    - Click Count (0)
  4. docs_src/response_headers/tutorial001_py310.py

    from fastapi import FastAPI
    from fastapi.responses import JSONResponse
    
    app = FastAPI()
    
    
    @app.get("/headers/")
    def get_headers():
        content = {"message": "Hello World"}
        headers = {"X-Cat-Dog": "alone in the world", "Content-Language": "en-US"}
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 309 bytes
    - Click Count (0)
  5. docs/en/docs/project-generation.md

    ## Full Stack FastAPI Template - Technology Stack and Features { #full-stack-fastapi-template-technology-stack-and-features }
    
    - ⚡ [**FastAPI**](https://fastapi.tiangolo.com) for the Python backend API.
      - 🧰 [SQLModel](https://sqlmodel.tiangolo.com) for the Python SQL database interactions (ORM).
      - 🔍 [Pydantic](https://docs.pydantic.dev), used by FastAPI, for the data validation and settings management.
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 1.9K bytes
    - Click Count (0)
  6. tests/test_list_bytes_file_order_preserved_issue_14811.py

    """
    Regression test: preserve order when using list[bytes] + File()
    See https://github.com/fastapi/fastapi/discussions/14811
    Fixed in PR: https://github.com/fastapi/fastapi/pull/14884
    """
    
    from typing import Annotated
    
    import anyio
    import pytest
    from fastapi import FastAPI, File
    from fastapi.testclient import TestClient
    from starlette.datastructures import UploadFile as StarletteUploadFile
    
    
    def test_list_bytes_file_preserves_order(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 10 12:14:38 GMT 2026
    - 1.4K bytes
    - Click Count (0)
  7. docs/ja/docs/project-generation.md

    # Full Stack FastAPI テンプレート { #full-stack-fastapi-template }
    
    テンプレートは通常、特定のセットアップが含まれていますが、柔軟でカスタマイズできるように設計されています。これにより、プロジェクトの要件に合わせて変更・適応でき、優れた出発点になります。🏁
    
    このテンプレートを使って開始できます。初期セットアップ、セキュリティ、データベース、いくつかのAPIエンドポイントがすでに用意されています。
    
    GitHubリポジトリ: [Full Stack FastAPI Template](https://github.com/tiangolo/full-stack-fastapi-template)
    
    ## Full Stack FastAPI テンプレート - 技術スタックと機能 { #full-stack-fastapi-template-technology-stack-and-features }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 2.4K bytes
    - Click Count (0)
  8. docs_src/response_model/tutorial003_04_py310.py

    from fastapi import FastAPI, Response
    from fastapi.responses import RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/portal")
    async def get_portal(teleport: bool = False) -> Response | dict:
        if teleport:
            return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Jan 10 16:22:47 GMT 2023
    - 352 bytes
    - Click Count (0)
  9. tests/test_security_http_basic_optional.py

    from base64 import b64encode
    
    from fastapi import FastAPI, Security
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    app = FastAPI()
    
    security = HTTPBasic(auto_error=False)
    
    
    @app.get("/users/me")
    def read_current_user(credentials: HTTPBasicCredentials | None = Security(security)):
        if credentials is None:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 2.7K bytes
    - Click Count (0)
  10. tests/test_orjson_response_class.py

    import warnings
    
    from fastapi import FastAPI
    from fastapi.exceptions import FastAPIDeprecationWarning
    from fastapi.responses import ORJSONResponse
    from fastapi.testclient import TestClient
    from sqlalchemy.sql.elements import quoted_name
    
    with warnings.catch_warnings():
        warnings.simplefilter("ignore", FastAPIDeprecationWarning)
        app = FastAPI(default_response_class=ORJSONResponse)
    
    
    @app.get("/orjson_non_str_keys")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 22 16:34:59 GMT 2026
    - 846 bytes
    - Click Count (0)
Back to Top