Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 68 for allowed (0.21 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. docs/de/docs/advanced/middleware.md

    {!../../../docs_src/advanced_middleware/tutorial002.py!}
    ```
    
    Die folgenden Argumente werden unterstรผtzt:
    
    * `allowed_hosts` โ€“ Eine Liste von Domain-Namen, die als Hostnamen zulรคssig sein sollten. Wildcard-Domains wie `*.example.com` werden unterstรผtzt, um Subdomains zu matchen. Um jeden Hostnamen zu erlauben, verwenden Sie entweder `allowed_hosts=["*"]` oder lassen Sie diese Middleware weg.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 20:18:15 GMT 2024
    - 4.4K bytes
    - Viewed (0)
  5. docs/em/docs/advanced/middleware.md

    ๐Ÿ› ๏ธ ๐Ÿ‘ˆ ๐ŸŒ ๐Ÿ“จ ๐Ÿ“จ โœ”๏ธ โ˜‘ โš’ `Host` ๐ŸŽš, โœ” ๐Ÿ’‚โ€โ™‚ ๐Ÿ›ก ๐Ÿ‡บ๐Ÿ‡ธ๐Ÿ” ๐Ÿฆ  ๐ŸŽš ๐Ÿ‘Š.
    
    ```Python hl_lines="2  6-8"
    {!../../../docs_src/advanced_middleware/tutorial002.py!}
    ```
    
    ๐Ÿ“„ โŒ ๐Ÿ•โ€๐Ÿฆบ:
    
    * `allowed_hosts` - ๐Ÿ“‡ ๐Ÿ†” ๐Ÿ“› ๐Ÿ‘ˆ ๐Ÿ”œ โœ” ๐Ÿ“›. ๐Ÿƒ ๐Ÿ†” โœ… `*.example.com` ๐Ÿ•โ€๐Ÿฆบ ๐ŸŽ€ ๐Ÿ“. โœ” ๐Ÿ™† ๐Ÿ“› ๐Ÿ‘ฏโ€โ™‚๏ธ โš™๏ธ `allowed_hosts=["*"]` โš–๏ธ ๐Ÿšซ ๐Ÿ› ๏ธ.
    
    ๐Ÿšฅ ๐Ÿ“จ ๐Ÿ“จ ๐Ÿ”จ ๐Ÿšซ โœ” โ˜‘ โคด๏ธ `400` ๐Ÿ“จ ๐Ÿ”œ ๐Ÿ“จ.
    
    ## `GZipMiddleware`
    
    ๐Ÿต ๐Ÿ—œ ๐Ÿ“จ ๐Ÿ™† ๐Ÿ“จ ๐Ÿ‘ˆ ๐Ÿ”Œ `"gzip"` `Accept-Encoding` ๐ŸŽš.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 3.3K bytes
    - Viewed (0)
  6. docs/en/docs/tutorial/cors.md

    * `allow_headers` - A list of HTTP request headers that should be supported for cross-origin requests. Defaults to `[]`. You can use `['*']` to allow all headers. The `Accept`, `Accept-Language`, `Content-Language` and `Content-Type` headers are always allowed for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests" class="external-link" rel="noopener" target="_blank">simple CORS...
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Nov 13 20:28:37 GMT 2022
    - 5.1K bytes
    - Viewed (0)
  7. 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)
  8. 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)
  9. 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)
  10. docs/zh/docs/advanced/middleware.md

    ## `TrustedHostMiddleware`
    
    ๅผบๅˆถๆ‰€ๆœ‰ไผ ๅ…ฅ่ฏทๆฑ‚้ƒฝๅฟ…้กปๆญฃ็กฎ่ฎพ็ฝฎ `Host` ่ฏทๆฑ‚ๅคด๏ผŒไปฅ้˜ฒ HTTP ไธปๆœบๅคดๆ”ปๅ‡ปใ€‚
    
    ```Python hl_lines="2  6-8"
    {!../../../docs_src/advanced_middleware/tutorial002.py!}
    ```
    
    ๆ”ฏๆŒไปฅไธ‹ๅ‚ๆ•ฐ๏ผš
    
    * `allowed_hosts` - ๅ…่ฎธ็š„ๅŸŸๅ๏ผˆไธปๆœบๅ๏ผ‰ๅˆ—่กจใ€‚`*.example.com` ็ญ‰้€š้…็ฌฆๅŸŸๅๅฏไปฅๅŒน้…ๅญๅŸŸๅ๏ผŒๆˆ–ไฝฟ็”จ `allowed_hosts=["*"]` ๅ…่ฎธไปปๆ„ไธปๆœบๅ๏ผŒๆˆ–็œ็•ฅไธญ้—ดไปถใ€‚
    
    ๅฆ‚ๆžœไผ ๅ…ฅ็š„่ฏทๆฑ‚ๆฒกๆœ‰้€š่ฟ‡้ชŒ่ฏ๏ผŒๅˆ™ๅ‘้€ `400` ๅ“ๅบ”ใ€‚
    
    ## `GZipMiddleware`
    
    ๅค„็† `Accept-Encoding` ่ฏทๆฑ‚ๅคดไธญๅŒ…ๅซ `gzip` ่ฏทๆฑ‚็š„ GZip ๅ“ๅบ”ใ€‚
    
    ไธญ้—ดไปถไผšๅค„็†ๆ ‡ๅ‡†ๅ“ๅบ”ไธŽๆตๅ“ๅบ”ใ€‚
    
    ```Python hl_lines="2  6"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 22:44:27 GMT 2024
    - 3.6K bytes
    - Viewed (0)
Back to top