3

Just started playing with Google App Engine & Python (as an excuse ;)). How do I correctly submit a form like this

<form action="https://www.moneybookers.com/app/payment.pl" method="post" target="_blank">
<input type="hidden" name="pay_to_email" value="[email protected]">
<input type="hidden" name="status_url"
<!-- etc. -->
<input type="submit" value="Pay!">
</form>

w/o exposing the data to user?

2 Answers 2

6

It sounds like you're looking for urllib.

Here's an example of POSTing from the library's docs:

>>> 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()
Sign up to request clarification or add additional context in comments.

Comments

0

By hiding the sensitive bits of the form and submitting it via 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.

3 Comments

He's asking for a solution in Python, not in Javascript.
I was just guessing this was what he wanted. As far as I know, there's no way of submitting a form in server-side Python and still let the user-agent see the resulting page.
No, but you can forward the result on to the client.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.