是否可以在Azure函数中返回生成器?我正在尝试流式传输正在创建的数据。我没有运气就尝试了以下方法:def main(req: func.HttpRequest) -> func.HttpResponse:
def gen():
for i in range(10):
yield i
return func.HttpResponse(gen(), mimetype='text/html')
以上产生TypeError: reponse is expected to be either of str, bytes, or bytearray, got generator
。是否可以在Azure函数中执行类似的操作?我不一定要求它在Python中,但是它是首选。
是否可以在Azure函数中返回生成器?我正在尝试在创建数据时流式传输数据。我没有运气尝试过以下命令:def main(req:func.HttpRequest)-> func ....
example
,您可能需要将响应转换为对象/字典。