lqs
d20566fe07
Some checks failed
Test / lint (push) Has been cancelled
Test / test (pydantic-v1, 3.10) (push) Has been cancelled
Test / test (pydantic-v1, 3.11) (push) Has been cancelled
Test / test (pydantic-v1, 3.12) (push) Has been cancelled
Test / test (pydantic-v1, 3.8) (push) Has been cancelled
Test / test (pydantic-v1, 3.9) (push) Has been cancelled
Test / test (pydantic-v2, 3.10) (push) Has been cancelled
Test / test (pydantic-v2, 3.11) (push) Has been cancelled
Test / test (pydantic-v2, 3.12) (push) Has been cancelled
Test / test (pydantic-v2, 3.8) (push) Has been cancelled
Test / test (pydantic-v2, 3.9) (push) Has been cancelled
Test / coverage-combine (push) Has been cancelled
Test / check (push) Has been cancelled
Issue Manager / issue-manager (push) Has been cancelled
Label Approved / label-approved (push) Has been cancelled
14 lines
391 B
Python
14 lines
391 B
Python
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
|
|
return tasks[task_id]
|