Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for title (0.16 sec)

  1. docs_src/response_directly/tutorial001.py

    from typing import Union
    
    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from fastapi.responses import JSONResponse
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        title: str
        timestamp: datetime
        description: Union[str, None] = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{id}")
    def update_item(id: str, item: Item):
        json_compatible_item_data = jsonable_encoder(item)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 505 bytes
    - Viewed (0)
  2. docs_src/body_fields/tutorial001.py

    from fastapi import Body, FastAPI
    from pydantic import BaseModel, Field
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = Field(
            default=None, title="The description of the item", max_length=300
        )
        price: float = Field(gt=0, description="The price must be greater than zero")
        tax: Union[float, None] = None
    
    
    @app.put("/items/{item_id}")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 561 bytes
    - Viewed (0)
  3. docs_src/custom_docs_ui/tutorial001.py

    )
    
    app = FastAPI(docs_url=None, redoc_url=None)
    
    
    @app.get("/docs", include_in_schema=False)
    async def custom_swagger_ui_html():
        return get_swagger_ui_html(
            openapi_url=app.openapi_url,
            title=app.title + " - Swagger UI",
            oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url,
            swagger_js_url="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-bundle.js",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Oct 30 09:58:58 GMT 2023
    - 1.1K bytes
    - Viewed (0)
  4. docs_src/openapi_callbacks/tutorial001.py

    from typing import Union
    
    from fastapi import APIRouter, FastAPI
    from pydantic import BaseModel, HttpUrl
    
    app = FastAPI()
    
    
    class Invoice(BaseModel):
        id: str
        title: Union[str, None] = None
        customer: str
        total: float
    
    
    class InvoiceEvent(BaseModel):
        description: str
        paid: bool
    
    
    class InvoiceEventReceived(BaseModel):
        ok: bool
    
    
    invoices_callback_router = APIRouter()
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 1.3K bytes
    - Viewed (0)
  5. docs_src/python_types/tutorial001.py

    def get_full_name(first_name, last_name):
        full_name = first_name.title() + " " + last_name.title()
        return full_name
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 162 bytes
    - Viewed (0)
  6. docs_src/body_multiple_params/tutorial001.py

        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int = Path(title="The ID of the item to get", ge=0, le=1000),
        q: Union[str, None] = None,
        item: Union[Item, None] = None,
    ):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
        if item:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 596 bytes
    - Viewed (0)
  7. docs_src/extending_openapi/tutorial001.py

    @app.get("/items/")
    async def read_items():
        return [{"name": "Foo"}]
    
    
    def custom_openapi():
        if app.openapi_schema:
            return app.openapi_schema
        openapi_schema = get_openapi(
            title="Custom title",
            version="2.5.0",
            summary="This is a very custom OpenAPI schema",
            description="Here's a longer description of the custom **OpenAPI** schema",
            routes=app.routes,
        )
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 737 bytes
    - Viewed (0)
  8. docs_src/websockets/tutorial001.py

    from fastapi import FastAPI, WebSocket
    from fastapi.responses import HTMLResponse
    
    app = FastAPI()
    
    html = """
    <!DOCTYPE html>
    <html>
        <head>
            <title>Chat</title>
        </head>
        <body>
            <h1>WebSocket Chat</h1>
            <form action="" onsubmit="sendMessage(event)">
                <input type="text" id="messageText" autocomplete="off"/>
                <button>Send</button>
            </form>
            <ul id='messages'>
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 1.4K bytes
    - Viewed (0)
  9. docs_src/path_params_numeric_validations/tutorial001.py

    from typing import Union
    
    from fastapi import FastAPI, Path, Query
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_items(
        item_id: int = Path(title="The ID of the item to get"),
        q: Union[str, None] = Query(default=None, alias="item-query"),
    ):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 364 bytes
    - Viewed (0)
  10. docs_src/encoder/tutorial001.py

    from datetime import datetime
    from typing import Union
    
    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from pydantic import BaseModel
    
    fake_db = {}
    
    
    class Item(BaseModel):
        title: str
        timestamp: datetime
        description: Union[str, None] = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{id}")
    def update_item(id: str, item: Item):
        json_compatible_item_data = jsonable_encoder(item)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 461 bytes
    - Viewed (0)
Back to top