Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 11 - 20 of 622 for Portal (0.08 seconds)

  1. docs_src/dependencies/tutorial008c_py310.py

            print("Oops, we didn't raise again, Britney 😱")
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: str = Depends(get_username)):
        if item_id == "portal-gun":
            raise InternalError(
                f"The portal gun is too dangerous to be owned by {username}"
            )
        if item_id != "plumbus":
            raise HTTPException(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 660 bytes
    - Click Count (0)
  2. docs_src/dependencies/tutorial008c_an_py310.py

            print("Oops, we didn't raise again, Britney 😱")
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id == "portal-gun":
            raise InternalError(
                f"The portal gun is too dangerous to be owned by {username}"
            )
        if item_id != "plumbus":
            raise HTTPException(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 700 bytes
    - Click Count (0)
  3. docs_src/stream_json_lines/tutorial001_py310.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None
    
    
    items = [
        Item(name="Plumbus", description="A multi-purpose household device."),
        Item(name="Portal Gun", description="A portal opening device."),
        Item(name="Meeseeks Box", description="A box that summons a Meeseeks."),
    ]
    
    
    @app.get("/items/stream")
    async def stream_items() -> AsyncIterable[Item]:
        for item in items:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 27 18:56:47 GMT 2026
    - 936 bytes
    - Click Count (0)
  4. docs_src/server_sent_events/tutorial001_py310.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None
    
    
    items = [
        Item(name="Plumbus", description="A multi-purpose household device."),
        Item(name="Portal Gun", description="A portal opening device."),
        Item(name="Meeseeks Box", description="A box that summons a Meeseeks."),
    ]
    
    
    @app.get("/items/stream", response_class=EventSourceResponse)
    async def sse_items() -> AsyncIterable[Item]:
    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)
  5. tests/test_sse.py

    
    class Item(BaseModel):
        name: str
        description: str | None = None
    
    
    items = [
        Item(name="Plumbus", description="A multi-purpose household device."),
        Item(name="Portal Gun", description="A portal opening device."),
        Item(name="Meeseeks Box", description="A box that summons a Meeseeks."),
    ]
    
    
    app = FastAPI()
    
    
    @app.get("/items/stream", response_class=EventSourceResponse)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 09:21:52 GMT 2026
    - 9.8K bytes
    - Click Count (0)
  6. docs/zh/docs/tutorial/stream-json-lines.md

    在这些场景中,常见的做法是发送 “JSON Lines”,这是一种每行发送一个 JSON 对象的格式。
    
    响应的内容类型是 `application/jsonl`(而不是 `application/json`),响应体类似这样:
    
    ```json
    {"name": "Plumbus", "description": "A multi-purpose household device."}
    {"name": "Portal Gun", "description": "A portal opening device."}
    {"name": "Meeseeks Box", "description": "A box that summons a Meeseeks."}
    ```
    
    它与 JSON 数组(相当于 Python 的 list)非常相似,但不是用 `[]` 包裹、并在各项之间使用 `,` 分隔,而是每行一个 JSON 对象,彼此以换行符分隔。
    
    /// info | 信息
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:29:48 GMT 2026
    - 4.2K bytes
    - Click Count (0)
  7. docs_src/path_operation_configuration/tutorial002b_py310.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    class Tags(Enum):
        items = "items"
        users = "users"
    
    
    @app.get("/items/", tags=[Tags.items])
    async def get_items():
        return ["Portal gun", "Plumbus"]
    
    
    @app.get("/users/", tags=[Tags.users])
    async def read_users():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 323 bytes
    - Click Count (0)
  8. docs_src/separate_openapi_schemas/tutorial001_py310.py

    
    app = FastAPI()
    
    
    @app.post("/items/")
    def create_item(item: Item):
        return item
    
    
    @app.get("/items/")
    def read_items() -> list[Item]:
        return [
            Item(
                name="Portal Gun",
                description="Device to travel through the multi-rick-verse",
            ),
            Item(name="Plumbus"),
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Aug 25 19:10:22 GMT 2023
    - 451 bytes
    - Click Count (0)
  9. docs_src/separate_openapi_schemas/tutorial002_py310.py

    
    @app.post("/items/")
    def create_item(item: Item):
        return item
    
    
    @app.get("/items/")
    def read_items() -> list[Item]:
        return [
            Item(
                name="Portal Gun",
                description="Device to travel through the multi-rick-verse",
            ),
            Item(name="Plumbus"),
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Aug 25 19:10:22 GMT 2023
    - 486 bytes
    - Click Count (0)
  10. docs_src/generate_clients/tutorial001_py310.py

    async def create_item(item: Item):
        return {"message": "item received"}
    
    
    @app.get("/items/", response_model=list[Item])
    async def get_items():
        return [
            {"name": "Plumbus", "price": 3},
            {"name": "Portal Gun", "price": 9001},
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 494 bytes
    - Click Count (0)
Back to Top