Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 29 for encoding (0.22 sec)

  1. docs/en/docs/advanced/middleware.md

    ## `HTTPSRedirectMiddleware`
    
    Enforces that all incoming requests must either be `https` or `wss`.
    
    Any incoming requests to `http` or `ws` will be redirected to the secure scheme instead.
    
    ```Python hl_lines="2  6"
    {!../../../docs_src/advanced_middleware/tutorial001.py!}
    ```
    
    ## `TrustedHostMiddleware`
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 10 18:27:10 GMT 2023
    - 4K bytes
    - Viewed (0)
  2. docs/en/docs/tutorial/response-model.md

        ```
    
    This will make FastAPI skip the response model generation and that way you can have any return type annotations you need without it affecting your FastAPI application. 🤓
    
    ## Response Model encoding parameters
    
    Your response model could have default values, like:
    
    === "Python 3.10+"
    
        ```Python hl_lines="9  11-12"
        {!> ../../../docs_src/response_model/tutorial004_py310.py!}
        ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 17.9K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_custom_request_and_route/test_tutorial001.py

    def test_gzip_request(compress):
        n = 1000
        headers = {}
        body = [1] * n
        data = json.dumps(body).encode()
        if compress:
            data = gzip.compress(data)
            headers["Content-Encoding"] = "gzip"
        headers["Content-Type"] = "application/json"
        response = client.post("/sum", content=data, headers=headers)
        assert response.json() == {"sum": n}
    
    
    def test_request_class():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Nov 13 14:26:09 GMT 2022
    - 886 bytes
    - Viewed (0)
  4. fastapi/openapi/models.py

        schema_: Optional[Union[Schema, Reference]] = Field(default=None, alias="schema")
        example: Optional[Any] = None
        examples: Optional[Dict[str, Union[Example, Reference]]] = None
        encoding: Optional[Dict[str, Encoding]] = None
    
    
    class ParameterBase(BaseModelWithConfig):
        description: Optional[str] = None
        required: Optional[bool] = None
        deprecated: Optional[bool] = None
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 22:49:33 GMT 2024
    - 15K bytes
    - Viewed (1)
  5. tests/test_tutorial/test_advanced_middleware/test_tutorial003.py

    
    client = TestClient(app)
    
    
    def test_middleware():
        response = client.get("/large", headers={"accept-encoding": "gzip"})
        assert response.status_code == 200, response.text
        assert response.text == "x" * 4000
        assert response.headers["Content-Encoding"] == "gzip"
        assert int(response.headers["Content-Length"]) < 4000
        response = client.get("/")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 665 bytes
    - Viewed (0)
  6. docs/en/docs/alternatives.md

    Another big feature needed by APIs is data validation, making sure that the data is valid, given certain parameters. For example, that some field is an `int`, and not some random string. This is especially useful for incoming data.
    
    Without a data validation system, you would have to do all the checks by hand, in code.
    
    These features are what Marshmallow was built to provide. It is a great library, and I have used it a lot before.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 23.2K bytes
    - Viewed (0)
  7. docs_src/custom_request_and_route/tutorial001.py

    
    class GzipRequest(Request):
        async def body(self) -> bytes:
            if not hasattr(self, "_body"):
                body = await super().body()
                if "gzip" in self.headers.getlist("Content-Encoding"):
                    body = gzip.decompress(body)
                self._body = body
            return self._body
    
    
    class GzipRoute(APIRoute):
        def get_route_handler(self) -> Callable:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 973 bytes
    - Viewed (0)
  8. docs/uk/docs/tutorial/extra-data-types.md

    * `datetime.timedelta`:
        * Пайтонівський `datetime.timedelta`.
        * У запитах та відповідях буде представлений як `float` загальної кількості секунд.
        * Pydantic також дозволяє представляти це як "ISO 8601 time diff encoding", <a href="https://docs.pydantic.dev/latest/concepts/serialization/#json_encoders" class="external-link" target="_blank">більше інформації дивись у документації</a>.
    * `frozenset`:
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 5.8K bytes
    - Viewed (0)
  9. docs/en/docs/tutorial/request-forms.md

    ## About "Form Fields"
    
    The way HTML forms (`<form></form>`) sends the data to the server normally uses a "special" encoding for that data, it's different from JSON.
    
    **FastAPI** will make sure to read that data from the right place instead of JSON.
    
    !!! note "Technical Details"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Mar 13 19:02:19 GMT 2024
    - 3.2K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/extra-data-types.md

    * `datetime.timedelta`:
        * A Python `datetime.timedelta`.
        * In requests and responses will be represented as a `float` of total seconds.
        * Pydantic also allows representing it as a "ISO 8601 time diff encoding", <a href="https://docs.pydantic.dev/latest/concepts/serialization/#json_encoders" class="external-link" target="_blank">see the docs for more info</a>.
    * `frozenset`:
        * In requests and responses, treated the same as a `set`:
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 4.1K bytes
    - Viewed (0)
Back to top