Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 61 - 70 of 795 for asyncId (0.19 seconds)

  1. fastapi/datastructures.py

    
        @app.post("/files/")
        async def create_file(file: Annotated[bytes, File()]):
            return {"file_size": len(file)}
    
    
        @app.post("/uploadfile/")
        async def create_upload_file(file: UploadFile):
            return {"filename": file.filename}
        ```
        """
    
        file: Annotated[
            BinaryIO,
            Doc("The standard Python file object (non-async)."),
        ]
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 15 11:44:39 GMT 2026
    - 5.2K bytes
    - Click Count (0)
  2. docs_src/stream_data/tutorial002_py310.py

        media_type = "image/png"
    
    
    @app.get("/image/stream", response_class=PNGStreamingResponse)
    async def stream_image() -> AsyncIterable[bytes]:
        with read_image() as image_file:
            for chunk in image_file:
                yield chunk
    
    
    @app.get("/image/stream-no-async", response_class=PNGStreamingResponse)
    def stream_image_no_async() -> Iterable[bytes]:
        with read_image() as image_file:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 27 20:51:40 GMT 2026
    - 5.6K bytes
    - Click Count (0)
  3. tests/test_dependency_cache.py

    counter_holder = {"counter": 0}
    
    
    async def dep_counter():
        counter_holder["counter"] += 1
        return counter_holder["counter"]
    
    
    async def super_dep(count: int = Depends(dep_counter)):
        return count
    
    
    @app.get("/counter/")
    async def get_counter(count: int = Depends(dep_counter)):
        return {"counter": count}
    
    
    @app.get("/sub-counter/")
    async def get_sub_counter(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Aug 23 13:30:24 GMT 2022
    - 2.7K bytes
    - Click Count (0)
  4. tests/test_dependency_yield_scope_websockets.py

    ]
    
    app = FastAPI()
    
    
    @app.websocket("/function-scope")
    async def function_scope(websocket: WebSocket, session: SessionFuncDep) -> Any:
        await websocket.accept()
        await websocket.send_json({"is_open": session.open})
    
    
    @app.websocket("/request-scope")
    async def request_scope(websocket: WebSocket, session: SessionRequestDep) -> Any:
        await websocket.accept()
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 6K bytes
    - Click Count (0)
  5. tests/test_router_events.py

    
    def test_merged_mixed_state_lifespans() -> None:
        @asynccontextmanager
        async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
            yield
    
        @asynccontextmanager
        async def router_lifespan(app: FastAPI) -> AsyncGenerator[dict[str, bool], None]:
            yield {"router": True}
    
        @asynccontextmanager
        async def sub_router_lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
            yield
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 11.7K bytes
    - Click Count (0)
  6. docs_src/stream_data/tutorial001_py310.py

    async def stream_story_no_annotation():
        for line in message.splitlines():
            yield line
    
    
    @app.get("/story/stream-no-async-no-annotation", response_class=StreamingResponse)
    def stream_story_no_async_no_annotation():
        for line in message.splitlines():
            yield line
    
    
    @app.get("/story/stream-bytes", response_class=StreamingResponse)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 27 18:56:47 GMT 2026
    - 2.2K bytes
    - Click Count (0)
  7. docs_src/stream_json_lines/tutorial001_py310.py

    ]
    
    
    @app.get("/items/stream")
    async def stream_items() -> AsyncIterable[Item]:
        for item in items:
            yield item
    
    
    @app.get("/items/stream-no-async")
    def stream_items_no_async() -> Iterable[Item]:
        for item in items:
            yield item
    
    
    @app.get("/items/stream-no-annotation")
    async def stream_items_no_annotation():
        for item in items:
            yield item
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 27 18:56:47 GMT 2026
    - 936 bytes
    - Click Count (0)
  8. docs/en/docs/advanced/events.md

    The first thing to notice, is that we are defining an async function with `yield`. This is very similar to Dependencies with `yield`.
    
    {* ../../docs_src/events/tutorial003_py310.py hl[14:19] *}
    
    The first part of the function, before the `yield`, will be executed **before** the application starts.
    
    And the part after the `yield` will be executed **after** the application has finished.
    
    ### Async Context Manager { #async-context-manager }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 7.8K bytes
    - Click Count (0)
  9. docs_src/custom_docs_ui/tutorial001_py310.py

        )
    
    
    @app.get(app.swagger_ui_oauth2_redirect_url, include_in_schema=False)
    async def swagger_ui_redirect():
        return get_swagger_ui_oauth2_redirect_html()
    
    
    @app.get("/redoc", include_in_schema=False)
    async def redoc_html():
        return get_redoc_html(
            openapi_url=app.openapi_url,
            title=app.title + " - ReDoc",
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 1.1K bytes
    - Click Count (0)
  10. docs_src/dependency_testing/tutorial001_py310.py

    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
        return {"q": q, "skip": skip, "limit": limit}
    
    
    @app.get("/items/")
    async def read_items(commons: dict = Depends(common_parameters)):
        return {"message": "Hello Items!", "params": commons}
    
    
    @app.get("/users/")
    async def read_users(commons: dict = Depends(common_parameters)):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1.4K bytes
    - Click Count (0)
Back to Top