将数据从 azure python 函数流式传输到客户端

Stream data from azure python functions to client

我有一个生成数据的 python 程序,它可能依赖网络服务来工作,这会减慢进程。

我想将此程序公开为 Web 服务,return 是一个要下载的文件(内容配置附件)

我认为最简单、成本最低的选择是无服务器。 我在 Azure 上有配额,所以我想尝试使用 Azure 函数。

Azure http python 函数必须 return 一个将响应正文作为参数的对象 func.HttpResponse()

但是,我不想在 return 响应之前在内存或临时文件中生成整个文件。 它可能是大文件,而且文件创建速度可能很慢。

文件完全可以在构建时传回给用户。 (return 带有块编码的 httpresponse)

这会减少人们调用该服务的等待时间,我相信会降低函数的成本(并发调用期间使用的内存更少)

是否可以使用 Azure HTTP 触发功能?如果不使用 Azure,它是在 GCP 上还是在 AWS 功能上?

谢谢MiniScalope。将您的评论作为答案发布以帮助其他社区成员。

As per the comment, you have found that it's only possible with C# as of now.

可以参考Out of proc languages stream support