Created
October 8, 2012 22:01
-
-
Save QuanSai/3855273 to your computer and use it in GitHub Desktop.
The of an auto voter for my friend.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mechanize | |
import cookielib | |
browser = mechanize.Browser() | |
# Cookie Jar | |
cj = cookielib.LWPCookieJar() | |
browser.set_cookiejar(cj) | |
# Browser options | |
browser.set_handle_equiv(True) | |
#br.set_handle_gzip(True) | |
browser.set_handle_redirect(True) | |
browser.set_handle_referer(True) | |
browser.set_handle_robots(False) | |
# User-Agent (this is cheating, ok?) | |
browser.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')] | |
browser.open('http://www.theunsignedtour.com/vote') | |
#browser.select_form(nr=0) | |
print browser.response().read() | |
for f in browser.form: | |
print f | |
#browser.form['firstname'] = 'username' | |
#browser.form['email'] = 'password' | |
#req = browser.submit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment