Python click voting script implementation code, python vote

Source: Internet
Author: User

Python click voting script implementation code, python vote

The principle is to use the proxy IP address to access the voting address. Multithreading is used, and the speed is fast.
I spent more than 1000 votes in the last two hours, mainly because the proxy IP address is hard to find.

2.7 run in Environment

#! /Usr/bin/env python #-*-coding: UTF-8-*-import urllib2 from threading import Thread from time import time class Vote (Thread ): def _ init _ (self, proxy): Thread. _ init _ (self) self. proxy = proxy self. url = 'HTTP: // www.studentboss.com/zhuanti/2014/cncc/vote.php? Id = 19 'self. timeout = 10 def run (self): proxy_handle = urllib2.ProxyHandler ({"http": r 'HTTP: // % s' % self. proxy}) opener = urllib2.build _ opener (proxy_handle) urllib2.install _ 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 T Exception, e: print e. message, 'error' def addnum (): global n + = 1 def shownum (): return 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 have been voted successfully using % s seconds' % (shownum (), time ()-start_time)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.