Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 171 - 180 of 220 for head_item (0.07 seconds)

  1. tests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py

    )
    async def read_with_get_token():
        return {"message": "Admin Access"}
    
    
    router = APIRouter(dependencies=[Security(oauth2_scheme, scopes=["read"])])
    
    
    @router.get("/items/")
    async def read_items(token: str | None = Depends(oauth2_scheme)):
        return {"token": token}
    
    
    @router.post("/items/")
    async def create_item(
        token: str | None = Security(oauth2_scheme, scopes=["read", "write"]),
    ):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 6.6K bytes
    - Click Count (0)
  2. docs/es/docs/index.md

    ```Python
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: str | None = None):
        return {"item_id": item_id, "q": q}
    ```
    
    <details markdown="1">
    <summary>O usa <code>async def</code>...</summary>
    
    Si tu código usa `async` / `await`, usa `async def`:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:15:55 GMT 2026
    - 22.6K bytes
    - Click Count (0)
  3. docs/pt/docs/index.md

    ```Python
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: str | None = None):
        return {"item_id": item_id, "q": q}
    ```
    
    <details markdown="1">
    <summary>Ou use <code>async def</code>...</summary>
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:20:43 GMT 2026
    - 22.7K bytes
    - Click Count (0)
  4. tests/test_regex_deprecated_params.py

    from inline_snapshot import snapshot
    
    from .utils import needs_py310
    
    
    def get_client():
        app = FastAPI()
        with pytest.warns(FastAPIDeprecationWarning):
    
            @app.get("/items/")
            async def read_items(
                q: Annotated[str | None, Query(regex="^fixedquery$")] = None,
            ):
                if q:
                    return f"Hello {q}"
                else:
                    return "Hello World"
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 5.1K bytes
    - Click Count (0)
  5. fastapi/exceptions.py

        ## Example
    
        ```python
        from fastapi import FastAPI, HTTPException
    
        app = FastAPI()
    
        items = {"foo": "The Foo Wrestlers"}
    
    
        @app.get("/items/{item_id}")
        async def read_item(item_id: str):
            if item_id not in items:
                raise HTTPException(status_code=404, detail="Item not found")
            return {"item": items[item_id]}
        ```
        """
    
        def __init__(
            self,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 11 18:41:21 GMT 2026
    - 7.3K bytes
    - Click Count (0)
  6. docs/en/docs/tutorial/dependencies/index.md

    * Get the result from your function.
    * Assign that result to the parameter in your *path operation function*.
    
    ```mermaid
    graph TB
    
    common_parameters(["common_parameters"])
    read_items["/items/"]
    read_users["/users/"]
    
    common_parameters --> read_items
    common_parameters --> read_users
    ```
    
    This way you write shared code once and **FastAPI** takes care of calling it for your *path operations*.
    
    /// check
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 9.5K bytes
    - Click Count (0)
  7. docs/fr/docs/index.md

    ```Python
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: str | None = None):
        return {"item_id": item_id, "q": q}
    ```
    
    <details markdown="1">
    <summary>Ou utilisez <code>async def</code>...</summary>
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:37:13 GMT 2026
    - 23.8K bytes
    - Click Count (0)
  8. docs/zh/docs/tutorial/dependencies/index.md

    接收到新的请求时,**FastAPI** 会负责:
    
    * 用正确的参数调用你的依赖项(“dependable”)函数
    * 获取函数返回的结果
    * 将该结果赋值给你的*路径操作函数*中的参数
    
    ```mermaid
    graph TB
    
    common_parameters(["common_parameters"])
    read_items["/items/"]
    read_users["/users/"]
    
    common_parameters --> read_items
    common_parameters --> read_users
    ```
    
    这样,你只需编写一次共享代码,**FastAPI** 会在你的*路径操作*中为你调用它。
    
    /// check | 检查
    
    注意,无需创建专门的类并传给 **FastAPI** 去“注册”之类的操作。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 8.7K bytes
    - Click Count (0)
  9. docs/tr/docs/tutorial/dependencies/index.md

    * Fonksiyonunuzun sonucunu alır.
    * Bu sonucu *path operation function*'ınızdaki parametreye atar.
    
    ```mermaid
    graph TB
    
    common_parameters(["common_parameters"])
    read_items["/items/"]
    read_users["/users/"]
    
    common_parameters --> read_items
    common_parameters --> read_users
    ```
    
    Bu şekilde paylaşılan kodu bir kez yazarsınız ve onu *path operation*'larda çağırma işini **FastAPI** halleder.
    
    /// check | Ek bilgi
    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)
  10. docs/tr/docs/index.md

    ```Python
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: str | None = None):
        return {"item_id": item_id, "q": q}
    ```
    
    <details markdown="1">
    <summary>Ya da <code>async def</code> kullanalım...</summary>
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 07:53:17 GMT 2026
    - 23.2K bytes
    - Click Count (0)
Back to Top