Python Cloud Function 之后重定向

pin*_*ock 5 python forms python-3.x google-cloud-platform google-cloud-functions

我的 HTML 表单有

action="https://us-central1-PROJECT_ID.cloudfunctions.net/FUNCTION_ID"
Run Code Online (Sandbox Code Playgroud)

method="post" target="_blank"
Run Code Online (Sandbox Code Playgroud)

该链接将电子邮件地址字符串发送到 Python 3.7 Beta 运行时中的 Google Cloud Function。

该函数正确执行并与第三方 API 交互。

该函数运行后会加载一个空白页面

OK
Run Code Online (Sandbox Code Playgroud)

作为唯一的内容。我想从这里重定向回我的网站,但我无法停止弄清楚如何做到这一点。我试过了

这样做的正确方法是什么?

Dus*_*ram 5

Google Cloud Functions在底层使用Flaskredirect来为您的端点提供服务,因此您只需在末尾返回 a 即可:

from flask import redirect

def test(request):
    return redirect('https://google.com')
Run Code Online (Sandbox Code Playgroud)