Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 1 of 1 for get_or_create_task (0.06 seconds)

  1. docs_src/response_change_status_code/tutorial001_py39.py

    from fastapi import FastAPI, Response, status
    
    app = FastAPI()
    
    tasks = {"foo": "Listen to the Bar Fighters"}
    
    
    @app.put("/get-or-create-task/{task_id}", status_code=200)
    def get_or_create_task(task_id: str, response: Response):
        if task_id not in tasks:
            tasks[task_id] = "This didn't exist before"
            response.status_code = status.HTTP_201_CREATED
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 391 bytes
    - Click Count (0)
Back to Top