How to do a Post Request in Python?
http-post, networking, python
Solution
I think this should do the trick:
import urllib
data = urllib.urlencode({"mode_login":"Agree","redirect":"http://stackoverflow.com"})
result = urllib.urlopen("http://192.168.100.1:5280/",data).read()
print result
Problem
Hi I'm sitting in a Greyhound Bus with Wifi and want to connect a second Device to the Network. But I have to accept an onscreen contract and the device does not have a browser. To accept the contract the following form has to be accepted. The device has no CURL but all the standard python 2.6. libraries. ``` <form method="POST" name="wifi" id="wifi" action="http://192.168.100.1:5280/"> <input type="image" name="mode_login" value="Agree" src="btn_accept.gif" /> <input type="hidden" name="redirect" value="http://stackoverflow.com/"> </form> ``` How would I write a quick python script to accept the contract?