Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 53 for Admin (0.25 sec)

  1. docs_src/bigger_applications/app/internal/admin.py

    from fastapi import APIRouter
    
    router = APIRouter()
    
    
    @router.post("/")
    async def update_admin():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Nov 29 17:32:18 GMT 2020
    - 147 bytes
    - Viewed (0)
  2. docs_src/bigger_applications/app_an_py39/internal/admin.py

    from fastapi import APIRouter
    
    router = APIRouter()
    
    
    @router.post("/")
    async def update_admin():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 147 bytes
    - Viewed (0)
  3. docs_src/bigger_applications/app_an/internal/admin.py

    from fastapi import APIRouter
    
    router = APIRouter()
    
    
    @router.post("/")
    async def update_admin():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 147 bytes
    - Viewed (0)
  4. tests/test_tutorial/test_settings/test_tutorial001.py

    @needs_pydanticv2
    def test_settings(monkeypatch: MonkeyPatch):
        monkeypatch.setenv("ADMIN_EMAIL", "admin@example.com")
        from docs_src.settings.tutorial001 import app
    
        client = TestClient(app)
        response = client.get("/info")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "app_name": "Awesome API",
            "admin_email": "admin@example.com",
            "items_per_user": 50,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 552 bytes
    - Viewed (0)
  5. docs_src/settings/tutorial001.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,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 419 bytes
    - Viewed (0)
  6. docs/en/docs/tutorial/bigger-applications.md

    ```
    
    That way, the original `APIRouter` will keep unmodified, so we can still share that same `app/internal/admin.py` file with other projects in the organization.
    
    The result is that in our app, each of the *path operations* from the `admin` module will have:
    
    * The prefix `/admin`.
    * The tag `admin`.
    * The dependency `get_token_header`.
    * The response `418`. 🍵
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  7. docs_src/settings/app02_an_py39/main.py

    @lru_cache
    def get_settings():
        return Settings()
    
    
    @app.get("/info")
    async def info(settings: Annotated[Settings, Depends(get_settings)]):
        return {
            "app_name": settings.app_name,
            "admin_email": settings.admin_email,
            "items_per_user": settings.items_per_user,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 445 bytes
    - Viewed (0)
  8. tests/test_tutorial/test_settings/test_app02.py

    from pytest import MonkeyPatch
    
    from ...utils import needs_pydanticv2
    
    
    @needs_pydanticv2
    def test_settings(monkeypatch: MonkeyPatch):
        from docs_src.settings.app02 import main
    
        monkeypatch.setenv("ADMIN_EMAIL", "admin@example.com")
        settings = main.get_settings()
        assert settings.app_name == "Awesome API"
        assert settings.items_per_user == 50
    
    
    @needs_pydanticv2
    def test_override_settings():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 488 bytes
    - Viewed (0)
  9. docs/zh/docs/tutorial/bigger-applications.md

    ```Python hl_lines="14-17" title="app/main.py"
    {!../../../docs_src/bigger_applications/app/main.py!}
    ```
    
    这样,原始的 `APIRouter` 将保持不变,因此我们仍然可以与组织中的其他项目共享相同的 `app/internal/admin.py` 文件。
    
    结果是在我们的应用程序中,来自 `admin` 模块的每个*路径操作*都将具有:
    
    * `/admin` 前缀 。
    * `admin` 标签。
    * `get_token_header` 依赖项。
    * `418` 响应。 🍵
    
    但这只会影响我们应用中的 `APIRouter`,而不会影响使用它的任何其他代码。
    
    因此,举例来说,其他项目能够以不同的身份认证方法使用相同的 `APIRouter`。
    
    ### 包含一个*路径操作*
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 18.5K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_settings/test_tutorial001_pv1.py

    @needs_pydanticv1
    def test_settings(monkeypatch: MonkeyPatch):
        monkeypatch.setenv("ADMIN_EMAIL", "admin@example.com")
        from docs_src.settings.tutorial001_pv1 import app
    
        client = TestClient(app)
        response = client.get("/info")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "app_name": "Awesome API",
            "admin_email": "admin@example.com",
            "items_per_user": 50,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 556 bytes
    - Viewed (0)
Back to top