Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 84 for Krause (0.19 sec)

  1. docs_src/app_testing/app_b/main.py

        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()):
        if x_token != fake_secret_token:
    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)
  2. docs_src/security/tutorial003_an_py39.py

    ):
        if current_user.disabled:
            raise HTTPException(status_code=400, detail="Inactive user")
        return current_user
    
    
    @app.post("/token")
    async def login(form_data: Annotated[OAuth2PasswordRequestForm, Depends()]):
        user_dict = fake_users_db.get(form_data.username)
        if not user_dict:
            raise HTTPException(status_code=400, detail="Incorrect username or password")
    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)
  3. docs_src/security/tutorial004.py

            username: str = payload.get("sub")
            if username is None:
                raise credentials_exception
            token_data = TokenData(username=username)
        except JWTError:
            raise credentials_exception
        user = get_user(fake_users_db, username=token_data.username)
        if user is None:
            raise credentials_exception
        return user
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4K bytes
    - Viewed (0)
  4. docs_src/security/tutorial004_an.py

            username: str = payload.get("sub")
            if username is None:
                raise credentials_exception
            token_data = TokenData(username=username)
        except JWTError:
            raise credentials_exception
        user = get_user(fake_users_db, username=token_data.username)
        if user is None:
            raise credentials_exception
        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
    - 4.1K bytes
    - Viewed (0)
  5. fastapi/security/http.py

            try:
                data = b64decode(param).decode("ascii")
            except (ValueError, UnicodeDecodeError, binascii.Error):
                raise invalid_user_credentials_exc  # noqa: B904
            username, separator, password = data.partition(":")
            if not separator:
                raise invalid_user_credentials_exc
            return HTTPBasicCredentials(username=username, password=password)
    
    
    class HTTPBearer(HTTPBase):
        """
    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)
  6. docs_src/path_operation_advanced_configuration/tutorial007.py

        raw_body = await request.body()
        try:
            data = yaml.safe_load(raw_body)
        except yaml.YAMLError:
            raise HTTPException(status_code=422, detail="Invalid YAML")
        try:
            item = Item.model_validate(data)
        except ValidationError as e:
            raise HTTPException(status_code=422, detail=e.errors(include_url=False))
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 822 bytes
    - Viewed (0)
  7. docs/em/docs/tutorial/handling-errors.md

    โžก๏ธ ๐Ÿ’ฌ ๐Ÿ‘† โœ”๏ธ ๐Ÿ›ƒ โš  `UnicornException` ๐Ÿ‘ˆ ๐Ÿ‘† (โš–๏ธ ๐Ÿ—ƒ ๐Ÿ‘† โš™๏ธ) ๐Ÿ’ช `raise`.
    
    & ๐Ÿ‘† ๐Ÿ’š ๐Ÿต ๐Ÿ‘‰ โš  ๐ŸŒ โฎ๏ธ FastAPI.
    
    ๐Ÿ‘† ๐Ÿ’ช ๐Ÿšฎ ๐Ÿ›ƒ โš  ๐Ÿ•โ€๐Ÿฆบ โฎ๏ธ `@app.exception_handler()`:
    
    ```Python hl_lines="5-7  13-18  24"
    {!../../../docs_src/handling_errors/tutorial003.py!}
    ```
    
    ๐Ÿ“ฅ, ๐Ÿšฅ ๐Ÿ‘† ๐Ÿ“จ `/unicorns/yolo`, *โžก ๐Ÿ› ๏ธ* ๐Ÿ”œ `raise` `UnicornException`.
    
    โœ‹๏ธ โšซ๏ธ ๐Ÿ”œ ๐Ÿต `unicorn_exception_handler`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 8.3K bytes
    - Viewed (0)
  8. docs_src/security/tutorial007_an.py

        correct_password_bytes = b"swordfish"
        is_correct_password = secrets.compare_digest(
            current_password_bytes, correct_password_bytes
        )
        if not (is_correct_username and is_correct_password):
            raise HTTPException(
                status_code=status.HTTP_401_UNAUTHORIZED,
                detail="Incorrect username or password",
                headers={"WWW-Authenticate": "Basic"},
            )
        return credentials.username
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_dependencies/test_tutorial008d_an.py

            exc_info.value.args[0] == "The portal gun is too dangerous to be owned by Rick"
        )
    
    
    def test_internal_server_error():
        from docs_src.dependencies.tutorial008d_an import app
    
        client = TestClient(app, raise_server_exceptions=False)
        response = client.get("/items/portal-gun")
        assert response.status_code == 500, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  10. docs/ja/docs/tutorial/handling-errors.md

    ใ‚ใชใŸ๏ผˆใพใŸใฏไฝฟ็”จใ—ใฆใ„ใ‚‹ใƒฉใ‚คใƒ–ใƒฉใƒช๏ผ‰ใŒ`raise`ใ™ใ‚‹ใ‹ใ‚‚ใ—ใ‚Œใชใ„ใ‚ซใ‚นใ‚ฟใƒ ไพ‹ๅค–`UnicornException`ใŒใ‚ใ‚‹ใจใ—ใพใ—ใ‚‡ใ†ใ€‚
    
    ใใ—ใฆใ€ใ“ใฎไพ‹ๅค–ใ‚’FastAPIใงใ‚ฐใƒญใƒผใƒใƒซใซๅ‡ฆ็†ใ—ใŸใ„ใจๆ€ใ„ใพใ™ใ€‚
    
    ใ‚ซใ‚นใ‚ฟใƒ ไพ‹ๅค–ใƒใƒณใƒ‰ใƒฉใ‚’`@app.exception_handler()`ใง่ฟฝๅŠ ใ™ใ‚‹ใ“ใจใŒใงใใพใ™:
    
    ```Python hl_lines="5 6 7  13 14 15 16 17 18  24"
    {!../../../docs_src/handling_errors/tutorial003.py!}
    ```
    
    ใ“ใ“ใงใ€`/unicorns/yolo`ใ‚’ใƒชใ‚ฏใ‚จใ‚นใƒˆใ™ใ‚‹ใจใ€*path operation*ใฏ`UnicornException`ใ‚’`raise`ใ—ใพใ™ใ€‚
    
    ใ—ใ‹ใ—ใ€ใ“ใ‚Œใฏ`unicorn_exception_handler`ใงๅ‡ฆ็†ใ•ใ‚Œใพใ™ใ€‚
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 11.8K bytes
    - Viewed (0)
Back to top