Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 221 - 230 of 795 for asyncId (0.07 seconds)

  1. tests/test_request_params/test_form/test_required_str.py

    # Without aliases
    
    
    @app.post("/required-str", operation_id="required_str")
    async def read_required_str(p: Annotated[str, Form()]):
        return {"p": p}
    
    
    class FormModelRequiredStr(BaseModel):
        p: str
    
    
    @app.post("/model-required-str", operation_id="model_required_str")
    async def read_model_required_str(p: Annotated[FormModelRequiredStr, Form()]):
        return {"p": p.p}
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Dec 27 18:19:10 GMT 2025
    - 10.6K bytes
    - Click Count (0)
  2. tests/test_request_params/test_query/test_optional_list.py

    # Without aliases
    
    
    @app.get("/optional-list-str")
    async def read_optional_list_str(
        p: Annotated[list[str] | None, Query()] = None,
    ):
        return {"p": p}
    
    
    class QueryModelOptionalListStr(BaseModel):
        p: list[str] | None = None
    
    
    @app.get("/model-optional-list-str")
    async def read_model_optional_list_str(
        p: Annotated[QueryModelOptionalListStr, Query()],
    ):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 9.4K bytes
    - Click Count (0)
  3. tests/test_list_bytes_file_order_preserved_issue_14811.py

        monkeypatch: pytest.MonkeyPatch,
    ) -> None:
        app = FastAPI()
    
        @app.post("/upload")
        async def upload(files: Annotated[list[bytes], File()]):
            # return something that makes order obvious
            return [b[0] for b in files]
    
        original_read = StarletteUploadFile.read
    
        async def patched_read(self: StarletteUploadFile, size: int = -1) -> bytes:
            # Make the FIRST file slower *deterministically*
    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)
  4. tests/test_request_params/test_header/test_required_str.py

    # Without aliases
    
    
    @app.get("/required-str")
    async def read_required_str(p: Annotated[str, Header()]):
        return {"p": p}
    
    
    class HeaderModelRequiredStr(BaseModel):
        p: str
    
    
    @app.get("/model-required-str")
    async def read_model_required_str(p: Annotated[HeaderModelRequiredStr, Header()]):
        return {"p": p.p}
    
    
    @pytest.mark.parametrize(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 10.3K bytes
    - Click Count (0)
  5. docs/uk/docs/tutorial/server-sent-events.md

    ///
    
    ### Не-async *функції операцій шляху* { #non-async-path-operation-functions }
    
    Ви також можете використовувати звичайні функції `def` (без `async`) і використовувати `yield` так само.
    
    FastAPI подбає про коректне виконання, щоб воно не блокувало цикл подій.
    
    Оскільки в цьому випадку функція не async, коректним типом повернення буде `Iterable[Item]`:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:25:54 GMT 2026
    - 7.1K bytes
    - Click Count (0)
  6. docs_src/path_params/tutorial003b_py310.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/users")
    async def read_users():
        return ["Rick", "Morty"]
    
    
    @app.get("/users")
    async def read_users2():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 193 bytes
    - Click Count (0)
  7. docs_src/request_files/tutorial001_py310.py

    from fastapi import FastAPI, File, UploadFile
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_file(file: bytes = File()):
        return {"file_size": len(file)}
    
    
    @app.post("/uploadfile/")
    async def create_upload_file(file: UploadFile):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 282 bytes
    - Click Count (0)
  8. tests/test_response_class_no_mediatype.py

    
    @app.get(
        "/a",
        response_class=Response,
        responses={500: {"description": "Error", "model": JsonApiError}},
    )
    async def a():
        pass  # pragma: no cover
    
    
    @app.get("/b", responses={500: {"description": "Error", "model": Error}})
    async def b():
        pass  # pragma: no cover
    
    
    client = TestClient(app)
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 3.6K bytes
    - Click Count (0)
  9. docs/zh/docs/tutorial/testing.md

    /// tip | 提示
    
    注意测试函数是普通的 `def`,不是 `async def`。
    
    还有client的调用也是普通的调用,不是用 `await`。
    
    这让你可以直接使用 `pytest` 而不会遇到麻烦。
    
    ///
    
    /// note | 技术细节
    
    你也可以用 `from starlette.testclient import TestClient`。
    
    **FastAPI** 提供了和 `starlette.testclient` 一样的 `fastapi.testclient`,只是为了方便开发者。但它直接来自Starlette。
    
    ///
    
    /// tip | 提示
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 5.4K bytes
    - Click Count (0)
  10. tests/test_request_params/test_file/test_list.py

    # Without aliases
    
    
    @app.post("/list-bytes", operation_id="list_bytes")
    async def read_list_bytes(p: Annotated[list[bytes], File()]):
        return {"file_size": [len(file) for file in p]}
    
    
    @app.post("/list-uploadfile", operation_id="list_uploadfile")
    async def read_list_uploadfile(p: Annotated[list[UploadFile], File()]):
        return {"file_size": [file.size for file in p]}
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Feb 21 13:01:31 GMT 2026
    - 11.6K bytes
    - Click Count (0)
Back to Top