Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 61 - 70 of 1,038 for Async (0.13 seconds)

  1. fastapi/.agents/skills/fastapi/references/other-tools.md

    ## ty
    
    If ty is available, use it to check types.
    
    ## Asyncer
    
    When needing to run blocking code inside of async functions, or async code inside of blocking functions, suggest using Asyncer.
    
    Prefer it over AnyIO or asyncio.
    
    Install:
    
    ```bash
    uv add asyncer
    ```
    
    Run blocking sync code inside of async with `asyncify()`:
    
    ```python
    from asyncer import asyncify
    from fastapi import FastAPI
    
    app = FastAPI()
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 10:05:57 GMT 2026
    - 1.5K bytes
    - Click Count (0)
  2. docs_src/server_sent_events/tutorial001_py310.py

    @app.get("/items/stream", response_class=EventSourceResponse)
    async def sse_items() -> AsyncIterable[Item]:
        for item in items:
            yield item
    
    
    @app.get("/items/stream-no-async", response_class=EventSourceResponse)
    def sse_items_no_async() -> Iterable[Item]:
        for item in items:
            yield item
    
    
    @app.get("/items/stream-no-annotation", response_class=EventSourceResponse)
    async def sse_items_no_annotation():
        for item in items:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 09:21:52 GMT 2026
    - 1.1K bytes
    - Click Count (0)
  3. docs_src/custom_request_and_route/tutorial001_an_py310.py

            async def custom_route_handler(request: Request) -> Response:
                request = GzipRequest(request.scope, request.receive)
                return await original_route_handler(request)
    
            return custom_route_handler
    
    
    app = FastAPI()
    app.router.route_class = GzipRoute
    
    
    @app.post("/sum")
    async def sum_numbers(numbers: Annotated[list[int], Body()]):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 10 08:55:32 GMT 2025
    - 1015 bytes
    - Click Count (0)
  4. docs_src/dependencies/tutorial001_py310.py

    from fastapi import Depends, FastAPI
    
    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 commons
    
    
    @app.get("/users/")
    async def read_users(commons: dict = Depends(common_parameters)):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 404 bytes
    - Click Count (0)
  5. docs_src/security/tutorial003_py310.py

        return user
    
    
    async def get_current_user(token: str = Depends(oauth2_scheme)):
        user = fake_decode_token(token)
        if not user:
            raise HTTPException(
                status_code=status.HTTP_401_UNAUTHORIZED,
                detail="Not authenticated",
                headers={"WWW-Authenticate": "Bearer"},
            )
        return user
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Nov 24 19:03:06 GMT 2025
    - 2.4K bytes
    - Click Count (0)
  6. src/main/java/jcifs/internal/witness/WitnessClient.java

                    } catch (InterruptedException e) {
                        log.debug("Async notification monitoring interrupted for {}", registrationId);
                        Thread.currentThread().interrupt();
                        break;
                    } catch (Exception e) {
                        log.debug("Error in async notification monitoring for {}: {}", registrationId, e.getMessage());
    
    Created: Sun Apr 05 00:10:12 GMT 2026
    - Last Modified: Sat Aug 30 05:58:03 GMT 2025
    - 20.8K bytes
    - Click Count (0)
  7. docs_src/dependencies/tutorial001_an_py310.py

    from fastapi import Depends, FastAPI
    
    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: Annotated[dict, Depends(common_parameters)]):
        return commons
    
    
    @app.get("/users/")
    async def read_users(commons: Annotated[dict, Depends(common_parameters)]):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 454 bytes
    - Click Count (0)
  8. docs_src/dependencies/tutorial006_py310.py

    from fastapi import Depends, FastAPI, Header, HTTPException
    
    app = FastAPI()
    
    
    async def verify_token(x_token: str = Header()):
        if x_token != "fake-super-secret-token":
            raise HTTPException(status_code=400, detail="X-Token header invalid")
    
    
    async def verify_key(x_key: str = Header()):
        if x_key != "fake-super-secret-key":
            raise HTTPException(status_code=400, detail="X-Key header invalid")
        return x_key
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 583 bytes
    - Click Count (0)
  9. docs_src/dependency_testing/tutorial001_an_py310.py

    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: Annotated[dict, Depends(common_parameters)]):
        return {"message": "Hello Items!", "params": commons}
    
    
    @app.get("/users/")
    async def read_users(commons: Annotated[dict, Depends(common_parameters)]):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1.5K bytes
    - Click Count (0)
  10. tests/test_strict_content_type_nested.py

    inner_strict = APIRouter(prefix="/strict", strict_content_type=True)
    inner_default = APIRouter(prefix="/default")
    
    
    @inner_strict.post("/items/")
    async def inner_strict_post(data: dict):
        return data
    
    
    @inner_default.post("/items/")
    async def inner_default_post(data: dict):
        return data
    
    
    outer_router.include_router(inner_strict)
    outer_router.include_router(inner_default)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Feb 23 17:45:20 GMT 2026
    - 2.7K bytes
    - Click Count (0)
Back to Top