Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 23 for allowed (0.2 sec)

  1. tests/test_jsonable_encoder.py

    def test_encode_model_with_pure_path():
        class ModelWithPath(BaseModel):
            path: PurePath
    
            if PYDANTIC_V2:
                model_config = {"arbitrary_types_allowed": True}
            else:
    
                class Config:
                    arbitrary_types_allowed = True
    
        test_path = PurePath("/foo", "bar")
        obj = ModelWithPath(path=test_path)
        assert jsonable_encoder(obj) == {"path": str(test_path)}
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 9K bytes
    - Viewed (0)
  2. fastapi/exception_handlers.py

    from fastapi.encoders import jsonable_encoder
    from fastapi.exceptions import RequestValidationError, WebSocketRequestValidationError
    from fastapi.utils import is_body_allowed_for_status_code
    from fastapi.websockets import WebSocket
    from starlette.exceptions import HTTPException
    from starlette.requests import Request
    from starlette.responses import JSONResponse, Response
    from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY, WS_1008_POLICY_VIOLATION
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Jun 11 19:08:14 GMT 2023
    - 1.3K bytes
    - Viewed (0)
  3. docs_src/advanced_middleware/tutorial002.py

    from fastapi import FastAPI
    from fastapi.middleware.trustedhost import TrustedHostMiddleware
    
    app = FastAPI()
    
    app.add_middleware(
        TrustedHostMiddleware, allowed_hosts=["example.com", "*.example.com"]
    )
    
    
    @app.get("/")
    async def main():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 279 bytes
    - Viewed (0)
  4. fastapi/openapi/utils.py

    from fastapi.params import Body, Param
    from fastapi.responses import Response
    from fastapi.types import ModelNameMap
    from fastapi.utils import (
        deep_dict_update,
        generate_operation_id_for_path,
        is_body_allowed_for_status_code,
    )
    from starlette.responses import JSONResponse
    from starlette.routing import BaseRoute
    from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY
    from typing_extensions import Literal
    
    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. fastapi/encoders.py

        if isinstance(obj, UndefinedType):
            return None
        if isinstance(obj, dict):
            encoded_dict = {}
            allowed_keys = set(obj.keys())
            if include is not None:
                allowed_keys &= set(include)
            if exclude is not None:
                allowed_keys -= set(exclude)
            for key, value in obj.items():
                if (
                    (
                        not sqlalchemy_safe
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 10.8K bytes
    - Viewed (0)
  6. tests/test_inherited_custom_class.py

            with pytest.raises(TypeError):
                vars(asyncpg_uuid)
            return {"fast_uuid": asyncpg_uuid}
    
        class SomeCustomClass(BaseModel):
            model_config = {"arbitrary_types_allowed": True}
    
            a_uuid: MyUuid
    
            @field_serializer("a_uuid")
            def serialize_a_uuid(self, v):
                return str(v)
    
        @app.get("/get_custom_class")
        def return_some_user():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3K bytes
    - Viewed (0)
  7. fastapi/param_functions.py

                """
            ),
        ] = _Unset,
        allow_inf_nan: Annotated[
            Union[bool, None],
            Doc(
                """
                Allow `inf`, `-inf`, `nan`. Only applicable to numbers.
                """
            ),
        ] = _Unset,
        max_digits: Annotated[
            Union[int, None],
            Doc(
                """
                Maximum number of allow digits for strings.
                """
            ),
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 62.5K bytes
    - Viewed (0)
  8. tests/test_custom_middleware_exception.py

    
    class ContentSizeLimitMiddleware:
        """Content size limiting middleware for ASGI applications
        Args:
          app (ASGI application): ASGI application
          max_content_size (optional): the maximum content size allowed in bytes, None for no limit
        """
    
        def __init__(self, app: APIRouter, max_content_size: Optional[int] = None):
            self.app = app
            self.max_content_size = max_content_size
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Aug 25 21:44:40 GMT 2022
    - 2.8K bytes
    - Viewed (0)
  9. fastapi/utils.py

        new_field.required = field.required  # type: ignore[misc]
        new_field.model_config = field.model_config  # type: ignore[attr-defined]
        new_field.field_info = field.field_info
        new_field.allow_none = field.allow_none  # type: ignore[attr-defined]
        new_field.validate_always = field.validate_always  # type: ignore[attr-defined]
        if field.sub_fields:  # type: ignore[attr-defined]
    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)
  10. scripts/docs.py

        return config
    
    
    def update_config() -> None:
        config = get_updated_config_content()
        en_config_path.write_text(
            yaml.dump(config, sort_keys=False, width=200, allow_unicode=True),
            encoding="utf-8",
        )
    
    
    @app.command()
    def verify_config() -> None:
        """
        Verify main mkdocs.yml content to make sure it uses the latest language names.
        """
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Jan 22 19:26:14 GMT 2024
    - 10.9K bytes
    - Viewed (1)
Back to top