Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 25 for Clauss (0.49 sec)

  1. docs_src/custom_response/tutorial001.py

    from fastapi import FastAPI
    from fastapi.responses import UJSONResponse
    
    app = FastAPI()
    
    
    @app.get("/items/", response_class=UJSONResponse)
    async def read_items():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 197 bytes
    - Viewed (0)
  2. docs_src/conditional_openapi/tutorial001.py

    from fastapi import FastAPI
    from pydantic_settings import BaseSettings
    
    
    class Settings(BaseSettings):
        openapi_url: str = "/openapi.json"
    
    
    settings = Settings()
    
    app = FastAPI(openapi_url=settings.openapi_url)
    
    
    @app.get("/")
    def root():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 281 bytes
    - Viewed (0)
  3. docs_src/body_nested_models/tutorial001.py

    from typing import Union
    
    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 = []
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
        results = {"item_id": item_id, "item": item}
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 402 bytes
    - Viewed (0)
  4. docs_src/response_directly/tutorial001.py

    from datetime import datetime
    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):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 505 bytes
    - Viewed (0)
  5. docs_src/body_fields/tutorial001.py

    from typing import Union
    
    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)
  6. docs_src/openapi_callbacks/tutorial001.py

    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)
  7. docs_src/settings/tutorial001.py

    from fastapi import FastAPI
    from pydantic_settings import BaseSettings
    
    
    class Settings(BaseSettings):
        app_name: str = "Awesome API"
        admin_email: str
        items_per_user: int = 50
    
    
    settings = Settings()
    app = FastAPI()
    
    
    @app.get("/info")
    async def info():
        return {
            "app_name": settings.app_name,
            "admin_email": settings.admin_email,
            "items_per_user": settings.items_per_user,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 419 bytes
    - Viewed (0)
  8. docs_src/separate_openapi_schemas/tutorial001.py

    from typing import List, Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
    
    
    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",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Aug 25 19:10:22 GMT 2023
    - 489 bytes
    - Viewed (0)
  9. docs_src/body_updates/tutorial001.py

    from typing import List, Union
    
    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: Union[str, None] = None
        description: Union[str, None] = None
        price: Union[float, None] = None
        tax: float = 10.5
        tags: List[str] = []
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 906 bytes
    - Viewed (0)
  10. docs_src/graphql/tutorial001.py

    import strawberry
    from fastapi import FastAPI
    from strawberry.asgi import GraphQL
    
    
    @strawberry.type
    class User:
        name: str
        age: int
    
    
    @strawberry.type
    class Query:
        @strawberry.field
        def user(self) -> User:
            return User(name="Patrick", age=100)
    
    
    schema = strawberry.Schema(query=Query)
    
    
    graphql_app = GraphQL(schema)
    
    app = FastAPI()
    app.add_route("/graphql", graphql_app)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Oct 03 18:00:28 GMT 2021
    - 446 bytes
    - Viewed (0)
Back to top