Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 121 - 130 of 795 for asyncId (0.06 seconds)

  1. docs_src/security/tutorial004_an_py310.py

        if user is None:
            raise credentials_exception
        return user
    
    
    async def get_current_active_user(
        current_user: Annotated[User, Depends(get_current_user)],
    ):
        if current_user.disabled:
            raise HTTPException(status_code=400, detail="Inactive user")
        return current_user
    
    
    @app.post("/token")
    async def login_for_access_token(
        form_data: Annotated[OAuth2PasswordRequestForm, Depends()],
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 18:10:35 GMT 2026
    - 4.2K bytes
    - Click Count (0)
  2. docs/zh-hant/docs/tutorial/dependencies/index.md

    當你在「大型程式碼庫」中,於許多「路徑操作」反覆使用「相同的依賴」時,這會特別有用。
    
    ## 要不要使用 `async` { #to-async-or-not-to-async }
    
    因為依賴也會由 **FastAPI** 呼叫(就像你的「路徑操作函式」),所以在定義函式時套用相同的規則。
    
    你可以使用 `async def` 或一般的 `def`。
    
    而且你可以在一般 `def` 的「路徑操作函式」中宣告 `async def` 的依賴,或在 `async def` 的「路徑操作函式」中宣告 `def` 的依賴,等等。
    
    都沒關係。**FastAPI** 會知道該怎麼做。
    
    /// note | 注意
    
    如果你不熟悉,請參考文件中的 [Async: "In a hurry?"](../../async.md#in-a-hurry) 一節,瞭解 `async` 與 `await`。
    
    ///
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 8.9K bytes
    - Click Count (0)
  3. docs_src/generate_clients/tutorial003_py310.py

    async def create_item(item: Item):
        return {"message": "Item received"}
    
    
    @app.get("/items/", response_model=list[Item], tags=["items"])
    async def get_items():
        return [
            {"name": "Plumbus", "price": 3},
            {"name": "Portal Gun", "price": 9001},
        ]
    
    
    @app.post("/users/", response_model=ResponseMessage, tags=["users"])
    async def create_user(user: User):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 914 bytes
    - Click Count (0)
  4. docs_src/request_files/tutorial002_an_py310.py

    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_files(files: Annotated[list[bytes], File()]):
        return {"file_sizes": [len(file) for file in files]}
    
    
    @app.post("/uploadfiles/")
    async def create_upload_files(files: list[UploadFile]):
        return {"filenames": [file.filename for file in files]}
    
    
    @app.get("/")
    async def main():
        content = """
    <body>
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 826 bytes
    - Click Count (0)
  5. docs/uk/docs/tutorial/stream-json-lines.md

    ///
    
    ### Не-async *функції операцій шляху* { #non-async-path-operation-functions }
    
    Ви також можете використовувати звичайні функції `def` (без `async`) і використовувати `yield` так само.
    
    FastAPI подбає про коректне виконання, щоб це не блокувало цикл подій.
    
    Оскільки в цьому випадку функція не є async, правильним типом повернення буде `Iterable[Item]`:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:25:54 GMT 2026
    - 6.6K bytes
    - Click Count (0)
  6. tests/test_request_param_model_by_alias.py

    
    class Model(BaseModel):
        param: str = Field(alias="param_alias")
    
    
    @app.get("/query")
    async def query_model(data: Model = Query()):
        return {"param": data.param}
    
    
    @app.get("/header")
    async def header_model(data: Model = Header()):
        return {"param": data.param}
    
    
    @app.get("/cookie")
    async def cookie_model(data: Model = Cookie()):
        return {"param": data.param}
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 2.1K bytes
    - Click Count (0)
  7. docs/fr/docs/advanced/events.md

    ```Python
    with open("file.txt") as file:
        file.read()
    ```
    
    Dans les versions récentes de Python, il existe aussi un **gestionnaire de contexte asynchrone**. Vous l'utiliseriez avec `async with` :
    
    ```Python
    async with lifespan(app):
        await do_stuff()
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:37:13 GMT 2026
    - 9.1K bytes
    - Click Count (0)
  8. docs/tr/docs/tutorial/dependencies/index.md

    ## `async` Olsa da Olmasa da { #to-async-or-not-to-async }
    
    Dependency'ler de **FastAPI** tarafından çağrılacağı için (tıpkı *path operation function*'larınız gibi), fonksiyonları tanımlarken aynı kurallar geçerlidir.
    
    `async def` ya da normal `def` kullanabilirsiniz.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 07:53:17 GMT 2026
    - 10.2K bytes
    - Click Count (0)
  9. docs_src/request_files/tutorial003_an_py310.py

    from fastapi.responses import HTMLResponse
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_files(
        files: Annotated[list[bytes], File(description="Multiple files as bytes")],
    ):
        return {"file_sizes": [len(file) for file in files]}
    
    
    @app.post("/uploadfiles/")
    async def create_upload_files(
        files: Annotated[
            list[UploadFile], File(description="Multiple files as UploadFile")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 952 bytes
    - Click Count (0)
  10. docs/es/docs/advanced/events.md

    ```Python
    with open("file.txt") as file:
        file.read()
    ```
    
    En versiones recientes de Python, también hay un **async context manager**. Lo usarías con `async with`:
    
    ```Python
    async with lifespan(app):
        await do_stuff()
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:15:55 GMT 2026
    - 8.4K bytes
    - Click Count (0)
Back to Top