Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 26 for Clauss (0.21 sec)

  1. tests/test_security_oauth2_optional.py

        flows={
            "password": {
                "tokenUrl": "token",
                "scopes": {"read:users": "Read the users", "write:users": "Create users"},
            }
        },
        auto_error=False,
    )
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: Optional[str] = Security(reusable_oauth2)):
        if oauth_header is None:
            return None
        user = User(username=oauth_header)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.8K bytes
    - Viewed (0)
  2. tests/test_jsonable_encoder.py

    from .utils import needs_pydanticv1, needs_pydanticv2
    
    
    class Person:
        def __init__(self, name: str):
            self.name = name
    
    
    class Pet:
        def __init__(self, owner: Person, name: str):
            self.owner = owner
            self.name = name
    
    
    @dataclass
    class Item:
        name: str
        count: int
    
    
    class DictablePerson(Person):
        def __iter__(self):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 9K bytes
    - Viewed (0)
  3. fastapi/security/api_key.py

    from starlette.exceptions import HTTPException
    from starlette.requests import Request
    from starlette.status import HTTP_403_FORBIDDEN
    from typing_extensions import Annotated, Doc
    
    
    class APIKeyBase(SecurityBase):
        pass
    
    
    class APIKeyQuery(APIKeyBase):
        """
        API key authentication using a query parameter.
    
        This defines the name of the query parameter that should be provided in the request
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 23 22:29:18 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  4. fastapi/openapi/utils.py

        if isinstance(route.response_class, DefaultPlaceholder):
            current_response_class: Type[Response] = route.response_class.value
        else:
            current_response_class = route.response_class
        assert current_response_class, "A response class is needed to generate OpenAPI"
        route_response_media_type: Optional[str] = current_response_class.media_type
        if route.include_in_schema:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 21.8K bytes
    - Viewed (0)
  5. tests/test_multi_body_errors.py

    from typing import List
    
    from dirty_equals import IsDict, IsOneOf
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, condecimal
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        age: condecimal(gt=Decimal(0.0))  # type: ignore
    
    
    @app.post("/items/")
    def save_item_no_body(item: List[Item]):
        return {"item": item}
    
    
    client = TestClient(app)
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.6K bytes
    - Viewed (0)
  6. tests/test_dependency_duplicates.py

    from dirty_equals import IsDict
    from fastapi import Depends, FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    client = TestClient(app)
    
    
    class Item(BaseModel):
        data: str
    
    
    def duplicate_dependency(item: Item):
        return item
    
    
    def dependency(item2: Item):
        return item2
    
    
    def sub_duplicate_dependency(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  7. fastapi/dependencies/utils.py

                    field_info=fastapi_annotation, annotation=use_annotation
                )
                assert field_info.default is Undefined or field_info.default is Required, (
                    f"`{field_info.__class__.__name__}` default value cannot be set in"
                    f" `Annotated` for {param_name!r}. Set the default value with `=` instead."
                )
                if value is not inspect.Signature.empty:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:52:56 GMT 2024
    - 29.5K bytes
    - Viewed (0)
  8. fastapi/security/oauth2.py

                client_secret=client_secret,
            )
    
    
    class OAuth2(SecurityBase):
        """
        This is the base class for OAuth2 authentication, an instance of it would be used
        as a dependency. All other OAuth2 classes inherit from it and customize it for
        each OAuth2 flow.
    
        You normally would not create a new class inheriting from it but use one of the
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 21.1K bytes
    - Viewed (1)
  9. fastapi/security/http.py

                """
            ),
        ]
    
    
    class HTTPBase(SecurityBase):
        def __init__(
            self,
            *,
            scheme: str,
            scheme_name: Optional[str] = None,
            description: Optional[str] = None,
            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
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 15:29:38 GMT 2024
    - 13.2K bytes
    - Viewed (0)
  10. fastapi/utils.py

        alias: Optional[str] = None,
        mode: Literal["validation", "serialization"] = "validation",
    ) -> ModelField:
        """
        Create a new response field. Raises if type_ is invalid.
        """
        class_validators = class_validators or {}
        if PYDANTIC_V2:
            field_info = field_info or FieldInfo(
                annotation=type_, default=default, alias=alias
            )
        else:
            field_info = field_info or FieldInfo()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.8K bytes
    - Viewed (0)
Back to top