Just started playing with Google App Engine & Python (as an excuse ;)). How do I correctly submit a form like this
刚开始玩Google App Engine和Python(作为借口;))。我如何正确提交这样的表格
<form action="https://www.moneybookers.com/app/payment.pl" method="post" target="_blank">
<input type="hidden" name="pay_to_email" value="ENTER_YOUR_USER_EMAIL@MERCHANT.COM">
<input type="hidden" name="status_url"
<!-- etc. -->
<input type="submit" value="Pay!">
</form>
w/o exposing the data to user?
没有将数据暴露给用户?
2 个解决方案
#1
It sounds like you're looking for urllib.
听起来你正在寻找urllib。
Here's an example of POSTing from the library's docs:
这是一个从库的文档POST的示例:
>>> import urllib
>>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query", params)
>>> print f.read()
#2
By hiding the sensitive bits of the form and submitting it via JavaScript.
通过隐藏表单的敏感位并通过JavaScript提交它。
Make sure you have a good way of referring to the form element...
确保你有一个很好的方式来引用表单元素......
<form ... id="moneybookersForm">...</form>
... and on page load, execute something like
...并在页面加载时执行类似的操作
document.getElementById("moneybookersForm").submit();
At least I don't know of other ways. For JavaScript-disabled people, the Pay! button should be kept visible.
至少我不知道其他方式。对于禁用JavaScript的人来说,付费!按钮应保持可见。
#1
It sounds like you're looking for urllib.
听起来你正在寻找urllib。
Here's an example of POSTing from the library's docs:
这是一个从库的文档POST的示例:
>>> import urllib
>>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query", params)
>>> print f.read()
#2
By hiding the sensitive bits of the form and submitting it via JavaScript.
通过隐藏表单的敏感位并通过JavaScript提交它。
Make sure you have a good way of referring to the form element...
确保你有一个很好的方式来引用表单元素......
<form ... id="moneybookersForm">...</form>
... and on page load, execute something like
...并在页面加载时执行类似的操作
document.getElementById("moneybookersForm").submit();
At least I don't know of other ways. For JavaScript-disabled people, the Pay! button should be kept visible.
至少我不知道其他方式。对于禁用JavaScript的人来说,付费!按钮应保持可见。