Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 25 for clear (0.22 sec)

  1. tests/test_dependency_contextmanager.py

        assert "/async_raise" in errors
        errors.clear()
    
    
    def test_async_raise_server_error():
        client = TestClient(app, raise_server_exceptions=False)
        response = client.get("/async_raise")
        assert response.status_code == 500, response.text
        assert state["/async_raise"] == "asyncgen raise finalized"
        assert "/async_raise" in errors
        errors.clear()
    
    
    def test_context_b():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  2. docs/en/docs/index.md

    ```Python
    item: Item
    ```
    
    ...and with that single declaration you get:
    
    * Editor support, including:
        * Completion.
        * Type checks.
    * Validation of data:
        * Automatic and clear errors when the data is invalid.
        * Validation even for deeply nested JSON objects.
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 23:58:47 GMT 2024
    - 19.2K bytes
    - Viewed (0)
  3. docs/en/docs/history-design-future.md

    ## Future
    
    By this point, it's already clear that **FastAPI** with its ideas is being useful for many people.
    
    It is being chosen over previous alternatives for suiting many use cases better.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  4. docs_src/events/tutorial003.py

    ml_models = {}
    
    
    @asynccontextmanager
    async def lifespan(app: FastAPI):
        # Load the ML model
        ml_models["answer_to_everything"] = fake_answer_to_everything_ml_model
        yield
        # Clean up the ML models and release the resources
        ml_models.clear()
    
    
    app = FastAPI(lifespan=lifespan)
    
    
    @app.get("/predict")
    async def predict(x: float):
        result = ml_models["answer_to_everything"](x)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 07 15:46:00 GMT 2023
    - 569 bytes
    - Viewed (0)
  5. docs/en/docs/release-notes.md

    @asynccontextmanager
    async def lifespan(app: FastAPI):
        # Load the ML model
        ml_models["answer_to_everything"] = fake_answer_to_everything_ml_model
        yield
        # Clean up the ML models and release the resources
        ml_models.clear()
    
    
    app = FastAPI(lifespan=lifespan)
    
    
    @app.get("/predict")
    async def predict(x: float):
        result = ml_models["answer_to_everything"](x)
    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)
  6. docs/en/docs/tutorial/body.md

    With just that Python type declaration, **FastAPI** will:
    
    * Read the body of the request as JSON.
    * Convert the corresponding types (if needed).
    * Validate the data.
        * If the data is invalid, it will return a nice and clear error, indicating exactly where and what was the incorrect data.
    * Give you the received data in the parameter `item`.
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 7.3K bytes
    - Viewed (0)
  7. docs/en/docs/advanced/advanced-dependencies.md

        ```Python hl_lines="20"
        {!> ../../../docs_src/dependencies/tutorial011.py!}
        ```
    
    !!! tip
        All this might seem contrived. And it might not be very clear how is it useful yet.
    
        These examples are intentionally simple, but show how it all works.
    
        In the chapters about security, there are utility functions that are implemented in this same way.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  8. README.md

    ```Python
    item: Item
    ```
    
    ...and with that single declaration you get:
    
    * Editor support, including:
        * Completion.
        * Type checks.
    * Validation of data:
        * Automatic and clear errors when the data is invalid.
        * Validation even for deeply nested JSON objects.
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 23:58:47 GMT 2024
    - 21.9K bytes
    - Viewed (0)
  9. docs/en/docs/advanced/events.md

    This can be very useful for setting up **resources** that you need to use for the whole app, and that are **shared** among requests, and/or that you need to **clean up** afterwards. For example, a database connection pool, or loading a shared machine learning model.
    
    ## Use Case
    
    Let's start with an example **use case** and then see how to solve it with this.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/handling-errors.md

    ```
    
    Here, if you request `/unicorns/yolo`, the *path operation* will `raise` a `UnicornException`.
    
    But it will be handled by the `unicorn_exception_handler`.
    
    So, you will receive a clean error, with an HTTP status code of `418` and a JSON content of:
    
    ```JSON
    {"message": "Oops! yolo did something. There goes a rainbow..."}
    ```
    
    !!! note "Technical Details"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.1K bytes
    - Viewed (0)
Back to top