Browse Source

🎨 Auto format

pull/15506/head
pre-commit-ci-lite[bot] 4 weeks ago
committed by GitHub
parent
commit
0e08b16516
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 21
      docs_src/openapi_callbacks/tutorial002_py310.py

21
docs_src/openapi_callbacks/tutorial002_py310.py

@ -10,7 +10,6 @@ class PassageProcessingRequest(BaseModel):
callback_url: str
@app.post("/callback")
async def callback(request: Request):
"""
@ -27,9 +26,7 @@ async def callback(request: Request):
print(data)
return {
"received": True
}
return {"received": True}
async def send_processing_result(callback_url: str, generated_passage: str):
@ -40,17 +37,13 @@ async def send_processing_result(callback_url: str, generated_passage: str):
async with httpx.AsyncClient() as client:
await client.post(
callback_url,
json={
"processed_passage": generated_passage,
"status": "completed"
}
json={"processed_passage": generated_passage, "status": "completed"},
)
@app.post("/process-passage")
async def process_passage(
data: PassageProcessingRequest,
background_tasks: BackgroundTasks
data: PassageProcessingRequest, background_tasks: BackgroundTasks
):
"""
Receives a passage processing request from the client.
@ -64,11 +57,7 @@ async def process_passage(
"""
background_tasks.add_task(
send_processing_result,
data.callback_url,
data.passage_topic
send_processing_result, data.callback_url, data.passage_topic
)
return {
"message": "Passage processing started"
}
return {"message": "Passage processing started"}

Loading…
Cancel
Save