Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 47 for original (0.17 sec)

  1. docs_src/custom_request_and_route/tutorial002.py

    from fastapi.routing import APIRoute
    
    
    class ValidationErrorLoggingRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                try:
                    return await original_route_handler(request)
                except RequestValidationError as exc:
                    body = await request.body()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 932 bytes
    - Viewed (0)
  2. fastapi/utils.py

        original_type = field.type_
        if is_dataclass(original_type) and hasattr(original_type, "__pydantic_model__"):
            original_type = original_type.__pydantic_model__
        use_type = original_type
        if lenient_issubclass(original_type, BaseModel):
            original_type = cast(Type[BaseModel], original_type)
            use_type = cloned_types.get(original_type)
            if use_type is None:
    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)
  3. docs/en/docs/advanced/testing-dependencies.md

    There are some scenarios where you might want to override a dependency during testing.
    
    You don't want the original dependency to run (nor any of the sub-dependencies it might have).
    
    Instead, you want to provide a different dependency that will be used only during tests (possibly only some specific tests), and will provide a value that can be used where the value of the original dependency was used.
    
    ### Use cases: external service
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 2.9K bytes
    - Viewed (0)
  4. docs_src/custom_request_and_route/tutorial003.py

    from fastapi.routing import APIRoute
    
    
    class TimedRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                before = time.time()
                response: Response = await original_route_handler(request)
                duration = time.time() - before
                response.headers["X-Response-Time"] = str(duration)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 1K bytes
    - Viewed (0)
  5. .github/workflows/issue-manager.yml

            with:
              token: ${{ secrets.FASTAPI_ISSUE_MANAGER }}
              config: >
                {
                  "answered": {
                    "delay": 864000,
                    "message": "Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs."
                  },
                  "changes-requested": {
                    "delay": 2628000,
    Others
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 30 18:46:56 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  6. docs/en/docs/how-to/custom-request-and-route.md

    This time, it will overwrite the method `APIRoute.get_route_handler()`.
    
    This method returns a function. And that function is what will receive a request and return a response.
    
    Here we use it to create a `GzipRequest` from the original request.
    
    ```Python hl_lines="18-26"
    {!../../../docs_src/custom_request_and_route/tutorial001.py!}
    ```
    
    !!! note "Technical Details"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Mar 31 23:52:53 GMT 2024
    - 4.4K bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/bigger-applications.md

    We can declare all that without having to modify the original `APIRouter` by passing those parameters to `app.include_router()`:
    
    ```Python hl_lines="14-17" title="app/main.py"
    {!../../../docs_src/bigger_applications/app/main.py!}
    ```
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  8. fastapi/dependencies/utils.py

                dependency_overrides_provider
                and dependency_overrides_provider.dependency_overrides
            ):
                original_call = sub_dependant.call
                call = getattr(
                    dependency_overrides_provider, "dependency_overrides", {}
                ).get(original_call, original_call)
                use_path: str = sub_dependant.path  # type: ignore
                use_sub_dependant = get_dependant(
    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)
  9. docs/en/docs/release-notes.md

    ### Features
    
    * ⚡ Update `create_cloned_field` to use a global cache and improve startup performance. PR [#4645](https://github.com/tiangolo/fastapi/pull/4645) by [@madkinsz](https://github.com/madkinsz) and previous original PR by [@huonw](https://github.com/huonw).
    
    ### Docs
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Apr 28 00:28:00 GMT 2024
    - 385.5K bytes
    - Viewed (1)
  10. docs/en/docs/tutorial/dependencies/dependencies-with-yield.md

    ### Always `raise` in Dependencies with `yield` and `except`
    
    If you catch an exception in a dependency with `yield`, unless you are raising another `HTTPException` or similar, you should re-raise the original exception.
    
    You can re-raise the same exception using `raise`:
    
    === "Python 3.9+"
    
        ```Python hl_lines="17"
        {!> ../../../docs_src/dependencies/tutorial008d_an_py39.py!}
        ```
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 14.1K bytes
    - Viewed (0)
Back to top