Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 211 - 220 of 795 for asyncId (0.07 seconds)

  1. tests/test_request_params/test_query/test_required_str.py

    # =====================================================================================
    # Without aliases
    
    
    @app.get("/required-str")
    async def read_required_str(p: str):
        return {"p": p}
    
    
    class QueryModelRequiredStr(BaseModel):
        p: str
    
    
    @app.get("/model-required-str")
    async def read_model_required_str(p: Annotated[QueryModelRequiredStr, Query()]):
        return {"p": p.p}
    
    
    @pytest.mark.parametrize(
        "path",
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 10.2K bytes
    - Click Count (0)
  2. tests/test_param_include_in_schema.py

    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    app = FastAPI()
    
    
    @app.get("/hidden_cookie")
    async def hidden_cookie(
        hidden_cookie: str | None = Cookie(default=None, include_in_schema=False),
    ):
        return {"hidden_cookie": hidden_cookie}
    
    
    @app.get("/hidden_header")
    async def hidden_header(
        hidden_header: str | None = Header(default=None, include_in_schema=False),
    ):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 8.6K bytes
    - Click Count (0)
  3. docs/fr/docs/tutorial/server-sent-events.md

    ///
    
    ### Fonctions de chemin d'accès non async { #non-async-path-operation-functions }
    
    Vous pouvez aussi utiliser des fonctions `def` normales (sans `async`), et utiliser `yield` de la même façon.
    
    FastAPI s’assure qu’elles s’exécutent correctement pour ne pas bloquer la boucle d’événements.
    
    Dans ce cas la fonction n’est pas async, le type de retour approprié serait `Iterable[Item]` :
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:33:45 GMT 2026
    - 5.3K bytes
    - Click Count (0)
  4. tests/test_request_params/test_header/test_optional_str.py

    # Without aliases
    
    
    @app.get("/optional-str")
    async def read_optional_str(p: Annotated[str | None, Header()] = None):
        return {"p": p}
    
    
    class HeaderModelOptionalStr(BaseModel):
        p: str | None = None
    
    
    @app.get("/model-optional-str")
    async def read_model_optional_str(p: Annotated[HeaderModelOptionalStr, Header()]):
        return {"p": p.p}
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 8.5K bytes
    - Click Count (0)
  5. docs_src/body_updates/tutorial001_py310.py

        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    @app.get("/items/{item_id}", response_model=Item)
    async def read_item(item_id: str):
        return items[item_id]
    
    
    @app.put("/items/{item_id}", response_model=Item)
    async def update_item(item_id: str, item: Item):
        update_item_encoded = jsonable_encoder(item)
        items[item_id] = update_item_encoded
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 856 bytes
    - Click Count (0)
  6. docs/zh-hant/docs/tutorial/stream-json-lines.md

    如果你要回傳的每個 JSON 項目型別都是 `Item`(一個 Pydantic 模型),而且該函式是 async,你可以將回傳型別宣告為 `AsyncIterable[Item]`:
    
    {* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[1:24] hl[9:11,22] *}
    
    如果你宣告了回傳型別,FastAPI 會用它來進行資料的**驗證**、在 OpenAPI 中**文件化**、**過濾**,並使用 Pydantic 進行**序列化**。
    
    /// tip
    
    由於 Pydantic 會在 **Rust** 端進行序列化,宣告回傳型別可獲得比未宣告時高得多的**效能**。
    
    ///
    
    ### 非 async 的*路徑操作函式* { #non-async-path-operation-functions }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:33:04 GMT 2026
    - 4.2K bytes
    - Click Count (0)
  7. tests/test_generic_parameterless_depends.py

    app = FastAPI()
    
    T = TypeVar("T")
    
    Dep = Annotated[T, Depends()]
    
    
    class A:
        pass
    
    
    class B:
        pass
    
    
    @app.get("/a")
    async def a(dep: Dep[A]):
        return {"cls": dep.__class__.__name__}
    
    
    @app.get("/b")
    async def b(dep: Dep[B]):
        return {"cls": dep.__class__.__name__}
    
    
    client = TestClient(app)
    
    
    def test_generic_parameterless_depends():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 2K bytes
    - Click Count (0)
  8. misc/wasm/wasm_exec.html

    	(see https://caniuse.com/#feat=textencoder)
    	-->
    	<script src="../../lib/wasm/wasm_exec.js"></script>
    	<script>
    		if (!WebAssembly.instantiateStreaming) { // polyfill
    			WebAssembly.instantiateStreaming = async (resp, importObject) => {
    				const source = await (await resp).arrayBuffer();
    				return await WebAssembly.instantiate(source, importObject);
    			};
    		}
    
    		const go = new Go();
    		let mod, inst;
    Created: Tue Apr 07 11:13:11 GMT 2026
    - Last Modified: Fri Aug 30 19:15:21 GMT 2024
    - 1.3K bytes
    - Click Count (0)
  9. docs/ja/docs/tutorial/dependencies/index.md

    これは **大規模なコードベース** で、**同じ依存関係** を **多くの *path operation*** で何度も使う場合に特に役立ちます。
    
    ## `async`にするかどうか { #to-async-or-not-to-async }
    
    依存関係は **FastAPI**(*path operation 関数*と同じ)からも呼び出されるため、関数を定義する際にも同じルールが適用されます。
    
    `async def`や通常の`def`を使用することができます。
    
    また、通常の`def`*path operation 関数*の中に`async def`を入れて依存関係を宣言したり、`async def`*path operation 関数*の中に`def`を入れて依存関係を宣言したりすることなどができます。
    
    それは重要ではありません。**FastAPI** は何をすべきかを知っています。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 11.9K bytes
    - Click Count (0)
  10. tests/test_request_params/test_file/test_optional.py

    # Without aliases
    
    
    @app.post("/optional-bytes", operation_id="optional_bytes")
    async def read_optional_bytes(p: Annotated[bytes | None, File()] = None):
        return {"file_size": len(p) if p else None}
    
    
    @app.post("/optional-uploadfile", operation_id="optional_uploadfile")
    async def read_optional_uploadfile(p: Annotated[UploadFile | None, File()] = None):
        return {"file_size": p.size if p else None}
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Feb 21 13:01:31 GMT 2026
    - 9.8K bytes
    - Click Count (0)
Back to Top