Search Options

Results per page
Sort
Preferred Languages
Advance

Results 171 - 180 of 1,926 for App (0.01 sec)

  1. docs_src/sql_databases/tutorial002_an_py39.py

    
    def get_session():
        with Session(engine) as session:
            yield session
    
    
    SessionDep = Annotated[Session, Depends(get_session)]
    app = FastAPI()
    
    
    @app.on_event("startup")
    def on_startup():
        create_db_and_tables()
    
    
    @app.post("/heroes/", response_model=HeroPublic)
    def create_hero(hero: HeroCreate, session: SessionDep):
        db_hero = Hero.model_validate(hero)
        session.add(db_hero)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  2. docs_src/openapi_webhooks/tutorial001_py39.py

    from datetime import datetime
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Subscription(BaseModel):
        username: str
        monthly_fee: float
        start_date: datetime
    
    
    @app.webhooks.post("new-subscription")
    def new_subscription(body: Subscription):
        """
        When a new user subscribes to your service we'll send you a POST request with this
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 550 bytes
    - Viewed (0)
  3. docs_src/response_model/tutorial001_py39.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: list[str] = []
    
    
    @app.post("/items/", response_model=Item)
    async def create_item(item: Item) -> Any:
        return item
    
    
    @app.get("/items/", response_model=list[Item])
    async def read_items() -> Any:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Jan 07 13:45:48 UTC 2023
    - 556 bytes
    - Viewed (0)
  4. docs_src/handling_errors/tutorial003_py39.py

        def __init__(self, name: str):
            self.name = name
    
    
    app = FastAPI()
    
    
    @app.exception_handler(UnicornException)
    async def unicorn_exception_handler(request: Request, exc: UnicornException):
        return JSONResponse(
            status_code=418,
            content={"message": f"Oops! {exc.name} did something. There goes a rainbow..."},
        )
    
    
    @app.get("/unicorns/{name}")
    async def read_unicorn(name: str):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 626 bytes
    - Viewed (0)
  5. tests/test_dependency_after_yield_websockets.py

    BrokenSessionDep = Annotated[Session, Depends(broken_dep_session)]
    
    app = FastAPI()
    
    
    @app.websocket("/ws")
    async def websocket_endpoint(websocket: WebSocket, session: SessionDep):
        await websocket.accept()
        for item in session:
            await websocket.send_text(f"{item}")
    
    
    @app.websocket("/ws-broken")
    async def websocket_endpoint_broken(websocket: WebSocket, session: BrokenSessionDep):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 2K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_advanced_middleware/test_tutorial003.py

    from fastapi.responses import PlainTextResponse
    from fastapi.testclient import TestClient
    
    from docs_src.advanced_middleware.tutorial003_py39 import app
    
    
    @app.get("/large")
    async def large():
        return PlainTextResponse("x" * 4000, status_code=200)
    
    
    client = TestClient(app)
    
    
    def test_middleware():
        response = client.get("/large", headers={"accept-encoding": "gzip"})
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 670 bytes
    - Viewed (0)
  7. tests/test_dependency_after_yield_raise.py

        raise ValueError("Broken after yield")
    
    
    app = FastAPI()
    
    
    @app.get("/catching")
    def catching(d: Annotated[str, Depends(catching_dep)]) -> Any:
        raise CustomError("Simulated error during streaming")
    
    
    @app.get("/broken")
    def broken(d: Annotated[str, Depends(broken_dep)]) -> Any:
        return {"message": "all good?"}
    
    
    client = TestClient(app)
    
    
    def test_catching():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  8. docs/es/docs/tutorial/first-steps.md

    Es el "**path operation decorator**".
    
    ///
    
    También puedes usar las otras operaciones:
    
    * `@app.post()`
    * `@app.put()`
    * `@app.delete()`
    
    Y los más exóticos:
    
    * `@app.options()`
    * `@app.head()`
    * `@app.patch()`
    * `@app.trace()`
    
    /// tip | Consejo
    
    Eres libre de usar cada operación (método HTTP) como quieras.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 13.3K bytes
    - Viewed (0)
  9. src/main/java/org/codelibs/fess/app/web/api/admin/group/ApiAdminGroupAction.java

    import org.apache.logging.log4j.Logger;
    import org.codelibs.fess.app.pager.GroupPager;
    import org.codelibs.fess.app.service.GroupService;
    import org.codelibs.fess.app.web.CrudMode;
    import org.codelibs.fess.app.web.api.ApiResult;
    import org.codelibs.fess.app.web.api.admin.FessApiAdminAction;
    import org.codelibs.fess.opensearch.user.exentity.Group;
    import org.codelibs.fess.opensearch.user.exentity.User;
    import org.lastaflute.web.Execute;
    Registered: Sat Dec 20 09:19:18 UTC 2025
    - Last Modified: Thu Aug 07 03:06:29 UTC 2025
    - 8K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_behind_a_proxy/test_tutorial004.py

    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    from docs_src.behind_a_proxy.tutorial004_py39 import app
    
    client = TestClient(app)
    
    
    def test_main():
        response = client.get("/app")
        assert response.status_code == 200
        assert response.json() == {"message": "Hello World", "root_path": "/api/v1"}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 1.4K bytes
    - Viewed (0)
Back to top