Search Options

Results per page
Sort
Preferred Languages
Advance

Results 811 - 820 of 1,977 for Fastapi (0.08 sec)

  1. docs/zh/docs/tutorial/security/first-steps.md

    该依赖项使用字符串(`str`)接收*路径操作函数*的参数 `token` 。
    
    **FastAPI** 使用依赖项在 OpenAPI 概图(及 API 文档)中定义**安全方案**。
    
    /// info | "技术细节"
    
    **FastAPI** 使用(在依赖项中声明的)类 `OAuth2PasswordBearer` 在 OpenAPI 中定义安全方案,这是因为它继承自 `fastapi.security.oauth2.OAuth2`,而该类又是继承自`fastapi.security.base.SecurityBase`。
    
    所有与 OpenAPI(及 API 文档)集成的安全工具都继承自 `SecurityBase`, 这就是为什么 **FastAPI** 能把它们集成至 OpenAPI 的原因。
    
    ///
    
    ## 实现的操作
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 7.3K bytes
    - Viewed (0)
  2. tests/test_sub_callbacks.py

    from typing import Optional
    
    from dirty_equals import IsDict
    from fastapi import APIRouter, FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, HttpUrl
    
    app = FastAPI()
    
    
    class Invoice(BaseModel):
        id: str
        title: Optional[str] = None
        customer: str
        total: float
    
    
    class InvoiceEvent(BaseModel):
        description: str
        paid: bool
    
    
    class InvoiceEventReceived(BaseModel):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 13.8K bytes
    - Viewed (0)
  3. docs/zh/docs/advanced/security/oauth2-scopes.md

    **FastAPI** 无缝集成 OAuth2 作用域(`Scopes`),可以直接使用。
    
    作用域是更精密的权限系统,遵循 OAuth2 标准,与 OpenAPI 应用(和 API 自动文档)集成。
    
    OAuth2 也是脸书、谷歌、GitHub、微软、推特等第三方身份验证应用使用的机制。这些身份验证应用在用户登录应用时使用 OAuth2 提供指定权限。
    
    脸书、谷歌、GitHub、微软、推特就是 OAuth2 作用域登录。
    
    本章介绍如何在 **FastAPI** 应用中使用 OAuth2 作用域管理验证与授权。
    
    /// warning | "警告"
    
    本章内容较难,刚接触 FastAPI 的新手可以跳过。
    
    OAuth2 作用域不是必需的,没有它,您也可以处理身份验证与授权。
    
    但 OAuth2 作用域与 API(通过 OpenAPI)及 API 文档集成地更好。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 11.8K bytes
    - Viewed (0)
  4. docs_src/security/tutorial004.py

    from datetime import datetime, timedelta, timezone
    from typing import Union
    
    import jwt
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
    from jwt.exceptions import InvalidTokenError
    from passlib.context import CryptContext
    from pydantic import BaseModel
    
    # to get a string like this run:
    # openssl rand -hex 32
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon May 20 17:37:28 UTC 2024
    - 4.1K bytes
    - Viewed (0)
  5. docs_src/security/tutorial004_an_py310.py

    from datetime import datetime, timedelta, timezone
    from typing import Annotated
    
    import jwt
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
    from jwt.exceptions import InvalidTokenError
    from passlib.context import CryptContext
    from pydantic import BaseModel
    
    # to get a string like this run:
    # openssl rand -hex 32
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon May 20 17:37:28 UTC 2024
    - 4.1K bytes
    - Viewed (0)
  6. tests/test_custom_middleware_exception.py

    from pathlib import Path
    from typing import Optional
    
    from fastapi import APIRouter, FastAPI, File, UploadFile
    from fastapi.exceptions import HTTPException
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    router = APIRouter()
    
    
    class ContentSizeLimitMiddleware:
        """Content size limiting middleware for ASGI applications
        Args:
          app (ASGI application): ASGI application
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Aug 25 21:44:40 UTC 2022
    - 2.8K bytes
    - Viewed (0)
  7. tests/test_union_inherited_body.py

    from typing import Optional, Union
    
    from dirty_equals import IsDict
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: Optional[str] = None
    
    
    class ExtendedItem(Item):
        age: int
    
    
    @app.post("/items/")
    def save_union_different_body(item: Union[ExtendedItem, Item]):
        return {"item": item}
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 5.2K bytes
    - Viewed (0)
  8. docs/es/docs/index.md

        <img src="https://github.com/fastapi/fastapi/workflows/Test/badge.svg" alt="Test">
    </a>
    <a href="https://codecov.io/gh/fastapi/fastapi" target="_blank">
        <img src="https://img.shields.io/codecov/c/github/fastapi/fastapi?color=%2334D058" alt="Coverage">
    </a>
    <a href="https://pypi.org/project/fastapi" target="_blank">
        <img src="https://img.shields.io/pypi/v/fastapi?color=%2334D058&label=pypi%20package" alt="Package version">
    </a>
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 20 19:20:23 UTC 2024
    - 19K bytes
    - Viewed (0)
  9. docs/de/docs/tutorial/schema-extra-example.md

    Aus diesem Grund verwendeten Versionen von FastAPI vor 0.99.0 immer noch Versionen von OpenAPI vor 3.1.0.
    
    ///
    
    ### Pydantic- und FastAPI-`examples`
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 13.2K bytes
    - Viewed (0)
  10. tests/test_serialize_response_dataclass.py

    from dataclasses import dataclass
    from datetime import datetime
    from typing import List, Optional
    
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @dataclass
    class Item:
        name: str
        date: datetime
        price: Optional[float] = None
        owner_ids: Optional[List[int]] = None
    
    
    @app.get("/items/valid", response_model=Item)
    def get_valid():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Aug 26 13:56:47 UTC 2022
    - 4.9K bytes
    - Viewed (0)
Back to top