Using mechanization to access a web page

This is my first programming experience with Python, and I'm trying to enter this web page. After searching, I found that many people suggested using mechanize. Just to be sure that I configured correctly, before I get the code, I downloaded the zip from mechanizethe website and got my python script in the unpacked mechanization folder.

I have this code so far, using different examples that I found:

import mechanize

theurl = 'http://voyager.umeres.maine.edu/Login'
mech = mechanize.Browser()
mech.open(theurl)

mech.select_form(nr=0)
mech["userid"] = "MYUSERNAME"
mech["password"] = "MYPASSWORD"
results = mech.submit().read()

f = file('test.html', 'w')
f.write(results) 
f.close()

- , / - . script IDLE, , - . : enter image description here   , , . , . , , - , , json RSS-, Python, , .

+5
1

, Mechanize robots.txt

.

:

mech = mechanize.Browser()
// needs to be set before you call open
mech.set_handle_robots(False)

: , - POST Javascript. , , , , , . POST :

challenge   [a14b1f67-11edcc01]
charset UTF-8
login   Login
origurl /Login/
password    
savedpw 0
sha1    3f77d1e8c2ab0470ef8005a85f5f9c0d7aeedba6
userid  sdsads
+4

All Articles