The principle is to use proxy IP to access the polling address. Use multi-threading, fast.
Last night two hours to brush more than 1000 votes, mainly agent IP is not good to find.
2.7 Operating in the environment
#!/usr/bin/env python #-*-coding:utf-8-*-import urllib2 from threading import Thread from time Import time class Vot E (Thread): Def __init__ (self, proxy): thread.__init__ (self) self.proxy = proxy Self.ur L = ' http://www.studentboss.com/zhuanti/2014/cncc/vote.php?id=19 ' self.timeout = ten def run (self): ProX Y_handle = Urllib2. Proxyhandler ({"http": R ' http://%s '% self.proxy}) opener = Urllib2.build_opener (proxy_handle) urllib2.inst All_opener (opener) Try:req = Urllib2.urlopen (Self.url, timeout=self.timeout) result = Req . Read (). Decode (' GBK ') print result pos = result.find (U ' success ') if POS > 1: Addnum () Else:pass except Exception,e:print e.message, ' error ' d EF addnum (): global n n + = 1 def shownum (): return n n = 0 threads = [] proxylist = open (' Proxy.txt ', ' R ') For PRoxy in proxylist:t = Vote (proxy) threads.append (t) if __name__ = = ' __main__ ': start_time = time () for I in Threads:i.start () for I in Threads:i.join () print '%s votes has been voted successfully us ing%s seconds '% (Shownum (), Time ()-start_time)