Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 81 - 90 of 795 for asyncId (0.16 seconds)

  1. docs/es/docs/tutorial/dependencies/index.md

    ## Usar `async` o no usar `async` { #to-async-or-not-to-async }
    
    Como las dependencias también serán llamadas por **FastAPI** (lo mismo que tus *path operation functions*), las mismas reglas aplican al definir tus funciones.
    
    Puedes usar `async def` o `def` normal.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:15:55 GMT 2026
    - 10K bytes
    - Click Count (0)
  2. docs_src/dependencies/tutorial012_py310.py

    from fastapi import Depends, FastAPI, Header, HTTPException
    
    
    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
    - 696 bytes
    - Click Count (0)
  3. tests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py

    )
    
    
    async def get_token(token: Annotated[str, Depends(oauth2_scheme)]) -> str:
        return token
    
    
    app = FastAPI(dependencies=[Depends(get_token)])
    
    
    @app.get("/")
    async def root():
        return {"message": "Hello World"}
    
    
    @app.get(
        "/with-oauth2-scheme",
        dependencies=[Security(oauth2_scheme, scopes=["read", "write"])],
    )
    async def read_with_oauth2_scheme():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 6.6K bytes
    - Click Count (0)
  4. docs_src/dependencies/tutorial012_an_py310.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI, Header, HTTPException
    
    
    async def verify_token(x_token: Annotated[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: Annotated[str, Header()]):
        if x_key != "fake-super-secret-key":
            raise HTTPException(status_code=400, detail="X-Key header invalid")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 746 bytes
    - Click Count (0)
  5. 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)
  6. tests/test_annotated.py

    from inline_snapshot import snapshot
    
    app = FastAPI()
    
    
    @app.get("/default")
    async def default(foo: Annotated[str, Query()] = "foo"):
        return {"foo": foo}
    
    
    @app.get("/required")
    async def required(foo: Annotated[str, Query(min_length=1)]):
        return {"foo": foo}
    
    
    @app.get("/multiple")
    async def multiple(foo: Annotated[str, object(), Query(min_length=1)]):
        return {"foo": foo}
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 10.5K bytes
    - Click Count (0)
  7. docs_src/request_files/tutorial002_py310.py

    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_files(files: list[bytes] = File()):
        return {"file_sizes": [len(file) for file in files]}
    
    
    @app.post("/uploadfiles/")
    async def create_upload_files(files: list[UploadFile]):
        return {"filenames": [file.filename for file in files]}
    
    
    @app.get("/")
    async def main():
        content = """
    <body>
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 786 bytes
    - Click Count (0)
  8. docs_src/custom_request_and_route/tutorial001_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: list[int] = Body()):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 10 08:55:32 GMT 2025
    - 976 bytes
    - Click Count (0)
  9. docs_src/custom_docs_ui/tutorial002_py310.py

            swagger_css_url="/static/swagger-ui.css",
        )
    
    
    @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/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)
Back to Top