Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 26 for name (0.14 sec)

  1. 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)
  2. docs_src/generate_clients/tutorial001.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
    
    
    class ResponseMessage(BaseModel):
        message: str
    
    
    @app.post("/items/", response_model=ResponseMessage)
    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},
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 04 22:02:18 GMT 2022
    - 519 bytes
    - Viewed (0)
  3. docs_src/events/tutorial001.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    items = {}
    
    
    @app.on_event("startup")
    async def startup_event():
        items["foo"] = {"name": "Fighters"}
        items["bar"] = {"name": "Tenders"}
    
    
    @app.get("/items/{item_id}")
    async def read_items(item_id: str):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 283 bytes
    - Viewed (0)
  4. 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)
  5. docs_src/templates/tutorial001.py

    app = FastAPI()
    
    app.mount("/static", StaticFiles(directory="static"), name="static")
    
    
    templates = Jinja2Templates(directory="templates")
    
    
    @app.get("/items/{id}", response_class=HTMLResponse)
    async def read_item(request: Request, id: str):
        return templates.TemplateResponse(
            request=request, name="item.html", context={"id": id}
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Dec 26 20:12:34 GMT 2023
    - 521 bytes
    - Viewed (0)
  6. docs_src/debugging/tutorial001.py

    import uvicorn
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    def root():
        a = "a"
        b = "b" + a
        return {"hello world": b}
    
    
    if __name__ == "__main__":
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 223 bytes
    - Viewed (0)
  7. docs_src/body_multiple_params/tutorial001.py

    from typing import Union
    
    from fastapi import FastAPI, Path
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        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,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 596 bytes
    - Viewed (0)
  8. 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)
  9. 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)
  10. docs_src/body_updates/tutorial001.py

    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},
        "bar": {"name": "Bar", "description": "The bartenders", "price": 62, "tax": 20.2},
        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 906 bytes
    - Viewed (0)
Back to top