Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 145 for resync (0.15 sec)

  1. docs_src/security/tutorial003_an_py39.py

        return user
    
    
    async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]):
        user = fake_decode_token(token)
        if not user:
            raise HTTPException(
                status_code=status.HTTP_401_UNAUTHORIZED,
                detail="Invalid authentication credentials",
                headers={"WWW-Authenticate": "Bearer"},
            )
        return user
    
    
    async def get_current_active_user(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 2.5K bytes
    - Viewed (0)
  2. docs_src/security/tutorial004.py

        if user is None:
            raise credentials_exception
        return user
    
    
    async def get_current_active_user(current_user: User = Depends(get_current_user)):
        if current_user.disabled:
            raise HTTPException(status_code=400, detail="Inactive user")
        return current_user
    
    
    @app.post("/token")
    async def login_for_access_token(
        form_data: OAuth2PasswordRequestForm = Depends(),
    ) -> Token:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4K bytes
    - Viewed (0)
  3. docs_src/security/tutorial004_an.py

        if user is None:
            raise credentials_exception
        return user
    
    
    async def get_current_active_user(
        current_user: Annotated[User, Depends(get_current_user)],
    ):
        if current_user.disabled:
            raise HTTPException(status_code=400, detail="Inactive user")
        return current_user
    
    
    @app.post("/token")
    async def login_for_access_token(
        form_data: Annotated[OAuth2PasswordRequestForm, Depends()],
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  4. docs/en/docs/advanced/dataclasses.md

    8. Notice that this *path operation function* uses regular `def` instead of `async def`.
    
        As always, in FastAPI you can combine `def` and `async def` as needed.
    
        If you need a refresher about when to use which, check out the section _"In a hurry?"_ in the docs about [`async` and `await`](../async.md#in-a-hurry){.internal-link target=_blank}.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  5. docs_src/app_testing/app_b/main.py

    @app.get("/items/{item_id}", response_model=Item)
    async def read_main(item_id: str, x_token: str = Header()):
        if x_token != fake_secret_token:
            raise HTTPException(status_code=400, detail="Invalid X-Token header")
        if item_id not in fake_db:
            raise HTTPException(status_code=404, detail="Item not found")
        return fake_db[item_id]
    
    
    @app.post("/items/", response_model=Item)
    async def create_item(item: Item, x_token: str = Header()):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 09 14:44:08 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  6. docs/em/docs/tutorial/request-files.md

    * `close()`: ๐Ÿ” ๐Ÿ“.
    
    ๐ŸŒ ๐Ÿ‘ซ ๐Ÿ‘ฉโ€๐Ÿ”ฌ `async` ๐Ÿ‘ฉโ€๐Ÿ”ฌ, ๐Ÿ‘† ๐Ÿ’ช "โŒ›" ๐Ÿ‘ซ.
    
    ๐Ÿ–ผ, ๐Ÿ”˜ `async` *โžก ๐Ÿ› ๏ธ ๐Ÿ”ข* ๐Ÿ‘† ๐Ÿ’ช ๐Ÿคš ๐ŸŽš โฎ๏ธ:
    
    ```Python
    contents = await myfile.read()
    ```
    
    ๐Ÿšฅ ๐Ÿ‘† ๐Ÿ”˜ ๐Ÿ˜ `def` *โžก ๐Ÿ› ๏ธ ๐Ÿ”ข*, ๐Ÿ‘† ๐Ÿ’ช ๐Ÿ” `UploadFile.file` ๐Ÿ”—, ๐Ÿ–ผ:
    
    ```Python
    contents = myfile.file.read()
    ```
    
    !!! note "`async` ๐Ÿ“ก โ„น"
        ๐Ÿ•โ” ๐Ÿ‘† โš™๏ธ `async` ๐Ÿ‘ฉโ€๐Ÿ”ฌ, **FastAPI** ๐Ÿƒ ๐Ÿ“ ๐Ÿ‘ฉโ€๐Ÿ”ฌ ๐Ÿงต & โŒ› ๐Ÿ‘ซ.
    
    !!! note "๐Ÿ’ƒ ๐Ÿ“ก โ„น"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Mar 13 19:02:19 GMT 2024
    - 6.6K bytes
    - Viewed (0)
  7. docs/ko/docs/tutorial/request-files.md

    * `close()`: ํŒŒ์ผ์„ ๋‹ซ์Šต๋‹ˆ๋‹ค.
    
    ์ƒ๊ธฐ ๋ชจ๋“  ๋ฉ”์†Œ๋“œ๋“ค์ด `async` ๋ฉ”์†Œ๋“œ์ด๊ธฐ ๋•Œ๋ฌธ์— โ€œawaitโ€์„ ์‚ฌ์šฉํ•˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค.
    
    ์˜ˆ๋ฅผ๋“ค์–ด, `async` *๊ฒฝ๋กœ ์ž‘๋™ ํ•จ์ˆ˜*์˜ ๋‚ด๋ถ€์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฐฉ์‹์œผ๋กœ ๋‚ด์šฉ์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
    
    ```Python
    contents = await myfile.read()
    ```
    
    ๋งŒ์•ฝ ์ผ๋ฐ˜์ ์ธ `def` *๊ฒฝ๋กœ ์ž‘๋™ ํ•จ์ˆ˜*์˜ ๋‚ด๋ถ€๋ผ๋ฉด, ๋‹ค์Œ๊ณผ ๊ฐ™์ด `UploadFile.file` ์— ์ง์ ‘ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
    
    ```Python
    contents = myfile.file.read()
    ```
    
    !!! note  "`async` ๊ธฐ์ˆ ์  ์„ธ๋ถ€์‚ฌํ•ญ"
        `async` ๋ฉ”์†Œ๋“œ๋“ค์„ ์‚ฌ์šฉํ•  ๋•Œ **FastAPI**๋Š” ์Šค๋ ˆ๋“œํ’€์—์„œ ํŒŒ์ผ ๋ฉ”์†Œ๋“œ๋“ค์„ ์‹คํ–‰ํ•˜๊ณ  ๊ทธ๋“ค์„ ๊ธฐ๋‹ค๋ฆฝ๋‹ˆ๋‹ค.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Mar 13 19:02:19 GMT 2024
    - 8.1K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/testing.md

    !!! tip
        If you want to call `async` functions in your tests apart from sending requests to your FastAPI application (e.g. asynchronous database functions), have a look at the [Async Tests](../advanced/async-tests.md){.internal-link target=_blank} in the advanced tutorial.
    
    ## Separating tests
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  9. fastapi/security/http.py

            auto_error: bool = True,
        ):
            self.model = HTTPBaseModel(scheme=scheme, description=description)
            self.scheme_name = scheme_name or self.__class__.__name__
            self.auto_error = auto_error
    
        async def __call__(
            self, request: Request
        ) -> Optional[HTTPAuthorizationCredentials]:
            authorization = request.headers.get("Authorization")
            scheme, credentials = get_authorization_scheme_param(authorization)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Apr 19 15:29:38 GMT 2024
    - 13.2K bytes
    - Viewed (0)
  10. docs_src/body/tutorial003.py

    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 09 14:28:58 GMT 2024
    - 362 bytes
    - Viewed (0)
Back to top