Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 65 for Bent (0.16 sec)

  1. docs_src/request_files/tutorial001_02_py310.py

    async def create_file(file: bytes | None = File(default=None)):
        if not file:
            return {"message": "No file sent"}
        else:
            return {"file_size": len(file)}
    
    
    @app.post("/uploadfile/")
    async def create_upload_file(file: UploadFile | None = None):
        if not file:
            return {"message": "No upload file sent"}
        else:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 470 bytes
    - Viewed (0)
  2. docs/en/docs/reference/background.md

    You can declare a parameter in a *path operation function* or dependency function with the type `BackgroundTasks`, and then you can use it to schedule the execution of background tasks after the response is sent.
    
    You can import it directly from `fastapi`:
    
    ```python
    from fastapi import BackgroundTasks
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 377 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_background_tasks/test_tutorial002_an.py

            os.remove(log)  # pragma: no cover
        response = client.post("/send-notification/******@****.***?q=some-query")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Message sent"}
        with open("./log.txt") as f:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 571 bytes
    - Viewed (0)
  4. tests/test_tutorial/test_background_tasks/test_tutorial002_an_py310.py

            os.remove(log)  # pragma: no cover
        response = client.post("/send-notification/******@****.***?q=some-query")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Message sent"}
        with open("./log.txt") as f:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 631 bytes
    - Viewed (0)
  5. docs_src/background_tasks/tutorial002_an_py310.py

        email: str, background_tasks: BackgroundTasks, q: Annotated[str, Depends(get_query)]
    ):
        message = f"message to {email}\n"
        background_tasks.add_task(write_log, message)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 683 bytes
    - Viewed (1)
  6. docs_src/handling_errors/tutorial006.py

        return await http_exception_handler(request, exc)
    
    
    @app.exception_handler(RequestValidationError)
    async def validation_exception_handler(request, exc):
        print(f"OMG! The client sent invalid data!: {exc}")
        return await request_validation_exception_handler(request, exc)
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: int):
        if item_id == 3:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Aug 09 11:10:33 GMT 2020
    - 928 bytes
    - Viewed (0)
  7. fastapi/security/oauth2.py

                ),
            ] = "",
            client_id: Annotated[
                Union[str, None],
                Form(),
                Doc(
                    """
                    If there's a `client_id`, it can be sent as part of the form fields.
                    But the OAuth2 specification recommends sending the `client_id` and
                    `client_secret` (if any) using HTTP Basic auth.
                    """
                ),
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 21.1K bytes
    - Viewed (1)
  8. tests/test_tutorial/test_schema_extra_example/test_tutorial004_an_py310.py

    @pytest.fixture(name="client")
    def get_client():
        from docs_src.schema_extra_example.tutorial004_an_py310 import app
    
        client = TestClient(app)
        return client
    
    
    # Test required and embedded body parameters with no bodies sent
    @needs_py310
    def test_post_body_example(client: TestClient):
        response = client.put(
            "/items/5",
            json={
                "name": "Foo",
                "description": "A very nice Item",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 7.1K bytes
    - Viewed (0)
  9. docs/en/docs/advanced/middleware.md

    If an incoming request does not validate correctly then a `400` response will be sent.
    
    ## `GZipMiddleware`
    
    Handles GZip responses for any request that includes `"gzip"` in the `Accept-Encoding` header.
    
    The middleware will handle both standard and streaming responses.
    
    ```Python hl_lines="2  6"
    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)
  10. docs/en/docs/advanced/generate-clients.md

    ### API Docs
    
    If you go to the API docs, you will see that it has the **schemas** for the data to be sent in requests and received in responses:
    
    <img src="/img/tutorial/generate-clients/image01.png">
    
    You can see those schemas because they were declared with the models in the app.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 10.5K bytes
    - Viewed (0)
Back to top