Search Options

Results per page
Sort
Preferred Languages
Advance

Results 111 - 120 of 1,094 for Fstr (0.05 sec)

  1. docs_src/background_tasks/tutorial002_an.py

    from fastapi import BackgroundTasks, Depends, FastAPI
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    def write_log(message: str):
        with open("log.txt", mode="a") as log:
            log.write(message)
    
    
    def get_query(background_tasks: BackgroundTasks, q: Union[str, None] = None):
        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 725 bytes
    - Viewed (0)
  2. docs_src/security/tutorial002_an_py39.py

    
    class User(BaseModel):
        username: str
        email: Union[str, None] = None
        full_name: Union[str, None] = None
        disabled: Union[bool, None] = None
    
    
    def fake_decode_token(token):
        return User(
            username=token + "fakedecoded", email="******@****.***", full_name="John Doe"
        )
    
    
    async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]):
        user = fake_decode_token(token)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 786 bytes
    - Viewed (0)
  3. docs_src/security/tutorial003_an.py

    app = FastAPI()
    
    
    def fake_hash_password(password: str):
        return "fakehashed" + password
    
    
    oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
    
    
    class User(BaseModel):
        username: str
        email: Union[str, None] = None
        full_name: Union[str, None] = None
        disabled: Union[bool, None] = None
    
    
    class UserInDB(User):
        hashed_password: str
    
    
    def get_user(db, username: str):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  4. docs_src/security/tutorial003_an_py39.py

    app = FastAPI()
    
    
    def fake_hash_password(password: str):
        return "fakehashed" + password
    
    
    oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
    
    
    class User(BaseModel):
        username: str
        email: Union[str, None] = None
        full_name: Union[str, None] = None
        disabled: Union[bool, None] = None
    
    
    class UserInDB(User):
        hashed_password: str
    
    
    def get_user(db, username: str):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  5. docs_src/response_model/tutorial005_py310.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float = 10.5
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
        "bar": {"name": "Bar", "description": "The Bar fighters", "price": 62, "tax": 20.2},
        "baz": {
            "name": "Baz",
            "description": "There goes my baz",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 816 bytes
    - Viewed (0)
  6. docs/ko/docs/tutorial/extra-data-types.md

        * 요청과 응답에서 `2008-09-15T15:53:00+05:00`와 같은 ISO 8601 형식의 `str`로 표현됩니다.
    * `datetime.date`:
        * 파이썬의 `datetime.date`.
        * 요청과 응답에서 `2008-09-15`와 같은 ISO 8601 형식의 `str`로 표현됩니다.
    * `datetime.time`:
        * 파이썬의 `datetime.time`.
        * 요청과 응답에서 `14:23:55.003`와 같은 ISO 8601 형식의 `str`로 표현됩니다.
    * `datetime.timedelta`:
        * 파이썬의 `datetime.timedelta`.
        * 요청과 응답에서 전체 초(seconds)의 `float`로 표현됩니다.
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 4.3K bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/metadata.md

    | Parameter | Type | Description |
    |------------|------|-------------|
    | `title` | `str` | The title of the API. |
    | `summary` | `str` | A short summary of the API. <small>Available since OpenAPI 3.1.0, FastAPI 0.99.0.</small> |
    | `description` | `str` | A short description of the API. It can use Markdown. |
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.8K bytes
    - Viewed (0)
  8. docs/zh/docs/tutorial/extra-data-types.md

    到目前为止,您一直在使用常见的数据类型,如:
    
    * `int`
    * `float`
    * `str`
    * `bool`
    
    但是您也可以使用更复杂的数据类型。
    
    您仍然会拥有现在已经看到的相同的特性:
    
    * 很棒的编辑器支持。
    * 传入请求的数据转换。
    * 响应数据转换。
    * 数据验证。
    * 自动补全和文档。
    
    ## 其他数据类型
    
    下面是一些你可以使用的其他数据类型:
    
    * `UUID`:
        * 一种标准的 "通用唯一标识符" ,在许多数据库和系统中用作ID。
        * 在请求和响应中将以 `str` 表示。
    * `datetime.datetime`:
        * 一个 Python `datetime.datetime`.
        * 在请求和响应中将表示为 ISO 8601 格式的 `str` ,比如: `2008-09-15T15:53:00+05:00`.
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 3.9K bytes
    - Viewed (0)
  9. docs_src/response_model/tutorial003_01_py310.py

    from fastapi import FastAPI
    from pydantic import BaseModel, EmailStr
    
    app = FastAPI()
    
    
    class BaseUser(BaseModel):
        username: str
        email: EmailStr
        full_name: str | None = None
    
    
    class UserIn(BaseUser):
        password: str
    
    
    @app.post("/user/")
    async def create_user(user: UserIn) -> BaseUser:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Jan 07 13:45:48 UTC 2023
    - 317 bytes
    - Viewed (0)
  10. docs_src/body_updates/tutorial001_py310.py

    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str | None = None
        description: str | None = None
        price: float | None = None
        tax: float = 10.5
        tags: list[str] = []
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
        "bar": {"name": "Bar", "description": "The bartenders", "price": 62, "tax": 20.2},
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 856 bytes
    - Viewed (0)
Back to top