Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 107 for stub (0.2 sec)

  1. fastapi/dependencies/utils.py

        dependency_cache = dependency_cache or {}
        sub_dependant: Dependant
        for sub_dependant in dependant.dependencies:
            sub_dependant.call = cast(Callable[..., Any], sub_dependant.call)
            sub_dependant.cache_key = cast(
                Tuple[Callable[..., Any], Tuple[str]], sub_dependant.cache_key
            )
            call = sub_dependant.call
            use_sub_dependant = sub_dependant
            if (
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:52:56 GMT 2024
    - 29.5K bytes
    - Viewed (0)
  2. tests/test_openapi_separate_input_output_schemas.py

            == response2.json()
            == {"name": "Plumbus", "description": None, "sub": None}
        )
    
    
    def test_create_item_with_sub():
        client = get_app_client()
        client_no = get_app_client(separate_input_output_schemas=False)
        data = {
            "name": "Plumbus",
            "sub": {"subname": "SubPlumbus", "sub_description": "Sub WTF"},
        }
        response = client.post("/items/", json=data)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 18.4K bytes
    - Viewed (2)
  3. tests/test_dependency_duplicates.py

    @app.post("/no-duplicates")
    async def no_duplicates(item: Item, item2: Item = Depends(dependency)):
        return [item, item2]
    
    
    @app.post("/with-duplicates-sub")
    async def no_duplicates_sub(
        item: Item, sub_items: List[Item] = Depends(sub_duplicate_dependency)
    ):
        return [item, sub_items]
    
    
    def test_no_duplicates_invalid():
        response = client.post("/no-duplicates", json={"item": {"data": "myitem"}})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  4. docs/es/docs/python-types.md

    * La variable `items_s` es un `set` y cada uno de sus ítems es de tipo `bytes`.
    
    #### Diccionarios (Dicts)
    
    Para definir un `dict` le pasas 2 sub-tipos separados por comas.
    
    El primer sub-tipo es para los keys del `dict`.
    
    El segundo sub-tipo es para los valores del `dict`:
    
    ```Python hl_lines="1  4"
    {!../../../docs_src/python_types/tutorial008.py!}
    ```
    
    Esto significa:
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.2K bytes
    - Viewed (0)
  5. tests/test_response_model_invalid.py

        with pytest.raises(FastAPIError):
            app = FastAPI()
    
            @app.get("/", response_model=NonPydanticModel)
            def read_root():
                pass  # pragma: nocover
    
    
    def test_invalid_response_model_sub_type_raises():
        with pytest.raises(FastAPIError):
            app = FastAPI()
    
            @app.get("/", response_model=List[NonPydanticModel])
            def read_root():
                pass  # pragma: nocover
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 29 13:04:35 GMT 2020
    - 1.1K bytes
    - Viewed (0)
  6. docs/en/docs/advanced/wsgi.md

    # Including WSGI - Flask, Django, others
    
    You can mount WSGI applications as you saw with [Sub Applications - Mounts](sub-applications.md){.internal-link target=_blank}, [Behind a Proxy](behind-a-proxy.md){.internal-link target=_blank}.
    
    For that, you can use the `WSGIMiddleware` and use it to wrap your WSGI application, for example, Flask, Django, etc.
    
    ## Using `WSGIMiddleware`
    
    You need to import `WSGIMiddleware`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  7. docs_src/security/tutorial004_py310.py

            detail="Could not validate credentials",
            headers={"WWW-Authenticate": "Bearer"},
        )
        try:
            payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
            username: str = payload.get("sub")
            if username is None:
                raise credentials_exception
            token_data = TokenData(username=username)
        except JWTError:
            raise credentials_exception
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4K bytes
    - Viewed (0)
  8. tests/test_include_route.py

    router = APIRouter()
    
    
    @router.route("/items/")
    def read_items(request: Request):
        return JSONResponse({"hello": "world"})
    
    
    app.include_router(router)
    
    client = TestClient(app)
    
    
    def test_sub_router():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Apr 08 04:37:38 GMT 2020
    - 496 bytes
    - Viewed (0)
  9. docs/en/docs/advanced/events.md

        Including how to handle lifespan state that can be used in other areas of your code.
    
    ## Sub Applications
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  10. docs/zh/docs/advanced/events.md

    # 事件:启动 - 关闭
    
    **FastAPI** 支持定义在应用启动前,或应用关闭后执行的事件处理器(函数)。
    
    事件函数既可以声明为异步函数(`async def`),也可以声明为普通函数(`def`)。
    
    !!! warning "警告"
    
        **FastAPI** 只执行主应用中的事件处理器,不执行[子应用 - 挂载](sub-applications.md){.internal-link target=_blank}中的事件处理器。
    
    ## `startup` 事件
    
    使用 `startup` 事件声明 `app` 启动前运行的函数:
    
    ```Python hl_lines="8"
    {!../../../docs_src/events/tutorial001.py!}
    ```
    
    本例中,`startup` 事件处理器函数为项目数据库(只是**字典**)提供了一些初始值。
    
    **FastAPI** 支持多个事件处理器函数。
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 1.7K bytes
    - Viewed (0)
Back to top