Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 391 - 400 of 1,555 for depend (0.08 seconds)

  1. tests/test_security_oauth2_authorization_code_bearer_scopes_openapi_simple.py

    )
    
    
    async def get_token(token: Annotated[str, Depends(oauth2_scheme)]) -> str:
        return token
    
    
    app = FastAPI(dependencies=[Depends(get_token)])
    
    
    @app.get("/admin", dependencies=[Security(get_token, scopes=["read", "write"])])
    async def read_admin():
        return {"message": "Admin Access"}
    
    
    client = TestClient(app)
    
    
    def test_read_admin():
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 2.6K bytes
    - Click Count (0)
  2. docs/zh/docs/tutorial/dependencies/index.md

    然后,依赖项函数返回包含这些值的 `dict`。
    
    ### 导入 `Depends`
    
    {* ../../docs_src/dependencies/tutorial001.py hl[3] *}
    
    ### 声明依赖项
    
    与在*路径操作函数*参数中使用 `Body`、`Query` 的方式相同,声明依赖项需要使用 `Depends` 和一个新的参数:
    
    {* ../../docs_src/dependencies/tutorial001.py hl[15,20] *}
    
    虽然,在路径操作函数的参数中使用 `Depends` 的方式与 `Body`、`Query` 相同,但 `Depends` 的工作方式略有不同。
    
    这里只能传给 Depends 一个参数。
    
    且该参数必须是可调用对象,比如函数。
    
    该函数接收的参数和*路径操作函数*的参数一样。
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Mon Nov 18 02:25:44 GMT 2024
    - 7K bytes
    - Click Count (0)
  3. docs/de/docs/advanced/advanced-dependencies.md

    In Version 0.121.0 hat FastAPI Unterstützung für `Depends(scope="function")` für Abhängigkeiten mit `yield` hinzugefügt.
    
    Mit `Depends(scope="function")` wird der Exit-Code nach `yield` direkt nach dem Ende der *Pfadoperation-Funktion* ausgeführt, bevor die Response an den Client gesendet wird.
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Tue Dec 02 17:32:56 GMT 2025
    - 10.4K bytes
    - Click Count (0)
  4. tests/test_security_api_key_query_optional.py

    from typing import Optional
    
    from fastapi import Depends, FastAPI, Security
    from fastapi.security import APIKeyQuery
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    api_key = APIKeyQuery(name="key", auto_error=False)
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: Optional[str] = Security(api_key)):
        if oauth_header is None:
            return None
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2K bytes
    - Click Count (0)
  5. tests/test_security_api_key_cookie_optional.py

    from typing import Optional
    
    from fastapi import Depends, FastAPI, Security
    from fastapi.security import APIKeyCookie
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    api_key = APIKeyCookie(name="key", auto_error=False)
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: Optional[str] = Security(api_key)):
        if oauth_header is None:
            return None
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.1K bytes
    - Click Count (0)
  6. scripts/translate.py

        skipped_paths: list[Path] = []
        for p in paths_to_process:
            lang_path = generate_lang_path(lang=language, path=p)
            if lang_path.exists():
                skipped_paths.append(p)
                continue
            missing_paths.append(p)
        print("Paths to skip:")
        for p in skipped_paths:
            print(f"  - {p}")
        print(f"Total paths to skip: {len(skipped_paths)}")
        print("Paths to process:")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 19:05:53 GMT 2025
    - 34.1K bytes
    - Click Count (0)
  7. tests/test_generic_parameterless_depends.py

    from typing import Annotated, TypeVar
    
    from fastapi import Depends, FastAPI
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    T = TypeVar("T")
    
    Dep = Annotated[T, Depends()]
    
    
    class A:
        pass
    
    
    class B:
        pass
    
    
    @app.get("/a")
    async def a(dep: Dep[A]):
        return {"cls": dep.__class__.__name__}
    
    
    @app.get("/b")
    async def b(dep: Dep[B]):
        return {"cls": dep.__class__.__name__}
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 1.8K bytes
    - Click Count (0)
  8. tests/test_enforce_once_required_parameter.py

        client_tag: Optional[str] = Depends(_get_client_tag),
    ):
        return {"client_id": client_key, "client_tag": client_tag}
    
    
    client = TestClient(app)
    
    expected_schema = {
        "components": {
            "schemas": {
                "HTTPValidationError": {
                    "properties": {
                        "detail": {
                            "items": {"$ref": "#/components/schemas/ValidationError"},
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Tue Sep 16 17:21:48 GMT 2025
    - 3.3K bytes
    - Click Count (0)
  9. impl/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java

                    messageBuffer
                            .append("<configuration>")
                            .append(LS)
                            .append("  ...")
                            .append(LS);
                    messageBuffer
                            .append("  <")
                            .append(alias)
                            .append(">VALUE</")
                            .append(alias)
    Created: Sun Dec 28 03:35:09 GMT 2025
    - Last Modified: Wed Jul 23 17:27:08 GMT 2025
    - 6.8K bytes
    - Click Count (0)
  10. fess-crawler-opensearch/src/test/java/org/codelibs/fess/crawler/util/CrawlerWebServer.java

                buf.append(".html\">File ");
                buf.append(count);
                buf.append("-");
                buf.append(i);
                buf.append("</a><br>");
                buf.append("<a href=\"dir");
                buf.append(count);
                buf.append("-");
                buf.append(i);
                buf.append("/index.html\">Dir ");
                buf.append(count);
                buf.append("-");
    Created: Sat Dec 20 11:21:39 GMT 2025
    - Last Modified: Sat Mar 15 06:52:00 GMT 2025
    - 5K bytes
    - Click Count (0)
Back to Top