Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 42 for log (0.14 sec)

  1. docs/ja/docs/tutorial/background-tasks.md

    **FastAPI** は、それぞれの場合の処理​​方法と同じオブジェクトの再利用方法を知っているため、すべてのバックグラウンドタスクがマージされ、バックグラウンドで後で実行されます。
    
    ```Python hl_lines="13  15  22  25"
    {!../../../docs_src/background_tasks/tutorial002.py!}
    ```
    
    この例では、レスポンスが送信された *後* にメッセージが `log.txt` ファイルに書き込まれます。
    
    リクエストにクエリがあった場合、バックグラウンドタスクでログに書き込まれます。
    
    そして、*path operations 関数* で生成された別のバックグラウンドタスクは、`email` パスパラメータを使用してメッセージを書き込みます。
    
    ## 技術的な詳細
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Jan 15 16:12:39 GMT 2024
    - 6.1K bytes
    - Viewed (0)
  2. docs/de/docs/tutorial/background-tasks.md

        {!> ../../../docs_src/background_tasks/tutorial002.py!}
        ```
    
    In obigem Beispiel werden die Nachrichten, *nachdem* die Response gesendet wurde, in die Datei `log.txt` geschrieben.
    
    Wenn im Request ein Query-Parameter enthalten war, wird dieser in einem Hintergrundtask in das Log geschrieben.
    
    Und dann schreibt ein weiterer Hintergrundtask, der in der *Pfadoperation-Funktion* erstellt wird, eine Nachricht unter Verwendung des Pfad-Parameters `email`.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 12 14:15:29 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/security/get-current-user.md

    Do you want to just have a `str`? Or just a `dict`? Or a database class model instance directly? It all works the same way.
    
    You actually don't have users that log in to your application but robots, bots, or other systems, that have just an access token? Again, it all works the same.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 7.6K bytes
    - Viewed (0)
  4. docs_src/background_tasks/tutorial002_an.py

    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    def write_log(message: str):
        with open("log.txt", mode="a") as log:
            log.write(message)
    
    
    def get_query(background_tasks: BackgroundTasks, q: Union[str, None] = None):
        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 725 bytes
    - Viewed (0)
  5. docs/de/docs/advanced/events.md

    ```Python hl_lines="6"
    {!../../../docs_src/events/tutorial002.py!}
    ```
    
    Hier schreibt die `shutdown`-Eventhandler-Funktion eine Textzeile `"Application shutdown"` in eine Datei `log.txt`.
    
    !!! info
        In der Funktion `open()` bedeutet `mode="a"` „append“ („anhängen“), sodass die Zeile nach dem, was sich in dieser Datei befindet, hinzugefügt wird, ohne den vorherigen Inhalt zu überschreiben.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 20:30:59 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  6. docs/pt/docs/advanced/events.md

    ```Python hl_lines="6"
    {!../../../docs_src/events/tutorial002.py!}
    ```
    
    Aqui, a função de manipulação de evento `shutdown` irá escrever uma linha de texto `"Application shutdown"` no arquivo `log.txt`.
    
    !!! info "Informação"
        Na função `open()`, o `mode="a"` significa "acrescentar", então, a linha irá ser adicionada depois de qualquer coisa que esteja naquele arquivo, sem sobrescrever o conteúdo anterior.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 8.6K bytes
    - Viewed (0)
  7. docs_src/background_tasks/tutorial002.py

    from fastapi import BackgroundTasks, Depends, FastAPI
    
    app = FastAPI()
    
    
    def write_log(message: str):
        with open("log.txt", mode="a") as log:
            log.write(message)
    
    
    def get_query(background_tasks: BackgroundTasks, q: Union[str, None] = None):
        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 675 bytes
    - Viewed (0)
  8. docs_src/background_tasks/tutorial002_py310.py

    from fastapi import BackgroundTasks, Depends, FastAPI
    
    app = FastAPI()
    
    
    def write_log(message: str):
        with open("log.txt", mode="a") as log:
            log.write(message)
    
    
    def get_query(background_tasks: BackgroundTasks, q: str | None = None):
        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 643 bytes
    - Viewed (0)
  9. tests/test_tutorial/test_background_tasks/test_tutorial002_py310.py

        client = TestClient(app)
        log = Path("log.txt")
        if log.is_file():
            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: Fri Jan 07 14:11:31 GMT 2022
    - 628 bytes
    - Viewed (0)
  10. tests/test_tutorial/test_background_tasks/test_tutorial002_an_py39.py

        client = TestClient(app)
        log = Path("log.txt")
        if log.is_file():
            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
    - 628 bytes
    - Viewed (0)
Back to top