Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 431 - 440 of 795 for asyncId (0.05 seconds)

  1. docs_src/custom_response/tutorial003_py310.py

    from fastapi import FastAPI
    from fastapi.responses import HTMLResponse
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items():
        html_content = """
        <html>
            <head>
                <title>Some HTML in here</title>
            </head>
            <body>
                <h1>Look ma! HTML!</h1>
            </body>
        </html>
        """
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 394 bytes
    - Click Count (0)
  2. docs_src/header_param_models/tutorial001_py310.py

    
    class CommonHeaders(BaseModel):
        host: str
        save_data: bool
        if_modified_since: str | None = None
        traceparent: str | None = None
        x_tag: list[str] = []
    
    
    @app.get("/items/")
    async def read_items(headers: CommonHeaders = Header()):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Sep 17 18:54:10 GMT 2024
    - 352 bytes
    - Click Count (0)
  3. docs_src/query_params_str_validations/tutorial001_py310.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: str | None = None):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 239 bytes
    - Click Count (0)
  4. docs_src/query_params_str_validations/tutorial014_py310.py

    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        hidden_query: str | None = Query(default=None, include_in_schema=False),
    ):
        if hidden_query:
            return {"hidden_query": hidden_query}
        else:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 298 bytes
    - Click Count (0)
  5. docs_src/response_model/tutorial003_02_py310.py

    from fastapi import FastAPI, Response
    from fastapi.responses import JSONResponse, RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/portal")
    async def get_portal(teleport: bool = False) -> Response:
        if teleport:
            return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 381 bytes
    - Click Count (0)
  6. docs_src/extra_models/tutorial004_py310.py

        description: str
    
    
    items = [
        {"name": "Foo", "description": "There comes my hero"},
        {"name": "Red", "description": "It's my aeroplane"},
    ]
    
    
    @app.get("/items/", response_model=list[Item])
    async def read_items():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 356 bytes
    - Click Count (0)
  7. docs_src/query_params_str_validations/tutorial006_py310.py

    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: str = Query(min_length=3)):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 254 bytes
    - Click Count (0)
  8. docs/ja/docs/tutorial/server-sent-events.md

    /// tip | 豆知識
    
    Pydantic が**Rust** 側でシリアライズを行うため、戻り値の型を宣言しない場合に比べて大幅に**高性能**になります。
    
    ///
    
    ### 非 async の *path operation 関数* { #non-async-path-operation-functions }
    
    通常の `def` 関数(`async` なし)も使用でき、同様に `yield` を使えます。
    
    イベントループをブロックしないよう、FastAPI が正しく実行されるように調整します。
    
    この場合は関数が async ではないため、適切な戻り値の型は `Iterable[Item]` です:
    
    {* ../../docs_src/server_sent_events/tutorial001_py310.py ln[28:31] hl[29] *}
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:55:22 GMT 2026
    - 5.8K bytes
    - Click Count (0)
  9. docs_src/body_nested_models/tutorial001_py310.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
        tags: list = []
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
        results = {"item_id": item_id, "item": item}
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 364 bytes
    - Click Count (0)
  10. docs_src/request_forms_and_files/tutorial001_py310.py

    from fastapi import FastAPI, File, Form, UploadFile
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_file(
        file: bytes = File(), fileb: UploadFile = File(), token: str = Form()
    ):
        return {
            "file_size": len(file),
            "token": token,
            "fileb_content_type": fileb.content_type,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 317 bytes
    - Click Count (0)
Back to Top