コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 2 of about 2 for notification (0.001 sec.)
バックグラウンドタスク 11228
バックグラウンドタスク レスポンスを返した 後に 実行されるバックグラウンドタスクを定義できます。 これは、リクエスト後に処理を開始する必要があるが、クライアントがレスポンスを受け取る前に処理を終える必要のない操作に役立ちます。 これには、たとえ ... tion 関数 のパラメーターを定義します: Python 3.8+ from fastapi import BackgroundTasks , FastAPI app = FastAPI () def write_notification ( email : str , message = "" ): with open ( "log.txt" , mode = "w" ) as email_file : content = f "notification for { email ... } : { message } " email_file . write ( content ) @app . post ( "/send-notification/ {email} " ) async def send_notification ( email : str , background_tasks : BackgroundTasks ): background_tasks . add_task ... ( write_notification , email , message = "some notification" ) return { "message" : "Notification sent in the background" } FastAPI は、 Backgr ...
https://man.mtool.work/fastapi/0.115/tutorial/background-tasks/
OpenAPI Callbacks 7485
OpenAPI Callbacks Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You could create an API with a path operation that could trigger a request to an external API cre ... Then your API will (let's imagine): Send the invoice to some customer of the external developer. Collect the money. Send a notification back to the API user (the external developer). This will be done by sending a POST request (from your API ) to some extern ... llback_router . post ( "{$callback_url}/invoices/{$request.body.id}" , response_model = InvoiceEventReceived ) def invoice_notification ( body : InvoiceEvent ): pass @app . post ( "/invoices/" , callbacks = invoices_callback_router . routes ) def create_invo ... an invoice. And this path operation will: * Send the invoice to the client. * Collect the money from the client. * Send a notification back to the API user (the external developer), as a callback. * At this point is that the API will somehow send a POST req ...
https://man.mtool.work/fastapi/0.115/advanced/openapi-callbacks/
PREV 1 NEXT