我有一个表单,可以向我的一个处理者发布信息。我的处理程序验证信息,然后需要将此信息发布给第三方,并将用户重定向到该页。
示例
class ExampleHandler(BaseRequestHandler):
"""DocString here...
"""
def post(self):
day = int(self.request.get('day'))
checked_day = CheckDay(day)
if checked_day:
#Here is where I would like to redirect the user to the 3rd party -- but via a post as I will be submitting a form based on data in checked_day on their behalf.
else:
# Otherwise no post redirect is needed -- just a simple self.redirect.
self.redirect('/example')
对于如何将用户重定向到我提交表单的页面,您有什么建议吗?
理想情况下,我希望有一个self.redirect()允许发布到第三方站点,但我不认为这是一个选项。
我的目标是在发送给第三方之前检查提供的数据。他们还有别的选择吗?
您可以发布表单并将用户重定向到页面,但它们必须是单独的操作。
urlfetch.fetch()
方法允许您将方法设置为如下所示:上面的例子来自URL Fetch Python API Overview。
相关问题 更多 >
编程相关推荐