How to make a mail request in Python?

Hi, I'm sitting on a Greyhound bus with Wi-Fi and want to connect the second device to the network. But I have to accept the screen contract, and there is no browser on the device. To accept the contract, the following form must be accepted. The device does not have CURL, but all standard versions of 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 do I write a quick python script to accept a contract?

+6
python networking
source share
1 answer

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 
+2
source share

All Articles