Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 331 - 340 of 795 for asyncId (0.04 seconds)

  1. docs_src/query_params/tutorial001_py310.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
    
    
    @app.get("/items/")
    async def read_item(skip: int = 0, limit: int = 10):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 250 bytes
    - Click Count (0)
  2. docs_src/custom_response/tutorial002_py310.py

    from fastapi import FastAPI
    from fastapi.responses import HTMLResponse
    
    app = FastAPI()
    
    
    @app.get("/items/", response_class=HTMLResponse)
    async def read_items():
        return """
        <html>
            <head>
                <title>Some HTML in here</title>
            </head>
            <body>
                <h1>Look ma! HTML!</h1>
            </body>
        </html>
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 352 bytes
    - Click Count (0)
  3. docs_src/app_testing/tutorial001_py310.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.get("/")
    async def read_main():
        return {"msg": "Hello World"}
    
    
    client = TestClient(app)
    
    
    def test_read_main():
        response = client.get("/")
        assert response.status_code == 200
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 334 bytes
    - Click Count (0)
  4. docs_src/response_model/tutorial003_01_py310.py

    app = FastAPI()
    
    
    class BaseUser(BaseModel):
        username: str
        email: EmailStr
        full_name: str | None = None
    
    
    class UserIn(BaseUser):
        password: str
    
    
    @app.post("/user/")
    async def create_user(user: UserIn) -> BaseUser:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Jan 07 13:45:48 GMT 2023
    - 317 bytes
    - Click Count (0)
  5. docs_src/request_form_models/tutorial002_py310.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class FormData(BaseModel):
        username: str
        password: str
        model_config = {"extra": "forbid"}
    
    
    @app.post("/login/")
    async def login(data: FormData = Form()):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 267 bytes
    - Click Count (0)
  6. docs_src/pydantic_v1_in_v2/tutorial002_an_py310.py

    from fastapi import FastAPI
    from pydantic.v1 import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        size: float
    
    
    app = FastAPI()
    
    
    @app.post("/items/")
    async def create_item(item: Item) -> Item:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Oct 11 16:45:54 GMT 2025
    - 252 bytes
    - Click Count (0)
  7. docs_src/settings/tutorial001_py310.py

    
    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,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 419 bytes
    - Click Count (0)
  8. docs_src/response_model/tutorial002_py310.py

    app = FastAPI()
    
    
    class UserIn(BaseModel):
        username: str
        password: str
        email: EmailStr
        full_name: str | None = None
    
    
    # Don't do this in production!
    @app.post("/user/")
    async def create_user(user: UserIn) -> UserIn:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Jan 07 13:45:48 GMT 2023
    - 318 bytes
    - Click Count (0)
  9. docs/ru/docs/index.md

    ```
    
    <details markdown="1">
    <summary>Или используйте <code>async def</code>...</summary>
    
    Если ваш код использует `async` / `await`, используйте `async def`:
    
    ```Python hl_lines="7  12"
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    async def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: int, q: str | None = None):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:56:20 GMT 2026
    - 30.4K bytes
    - Click Count (0)
  10. docs_src/security/tutorial001_an_py310.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI
    from fastapi.security import OAuth2PasswordBearer
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
    
    
    @app.get("/items/")
    async def read_items(token: Annotated[str, Depends(oauth2_scheme)]):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 309 bytes
    - Click Count (0)
Back to Top