GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-python

support of async views

オープン
#192 コメント 3 件 リアクション 11 件 担当者 1 名 @jama22 が担当を希望しています GitHub で見る
enhancement
主要言語
Python
スター
968
フォーク
128
PR マージ指標
30日以内にマージされた PR はありません

説明

Similarly to Flask, the framework should support `async` function for a view - see https://flask.palletsprojects.com/en/2.1.x/async-await/
Under the hood, Flask executes `asyncio.run()` and returns the resulting value to the client.

When trying to define the view function with `async`, one gets `TypeError: The view function did not return a valid response. The return type must be a string, dict, tuple, Response instance, or WSGI callable, but it was a coroutine.`

Workaround is simply to create a "regular" sync function that executes (`asyncio.run()`) a separate async function but it could be simpler and match Flask functionality.

Our use case: use Google Cloud Functions from BigQuery Remote Function to call external APIs concurrently (using `aiohttp`).

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。