Today hit brush recommended Python script

Source: Internet
Author: User
Tags python script

Import httplibimport randomimport timeimport urllib2import readdress = raw_input ("Please input the website address") count = Int (raw_input ("Please input the Add count number") req = Urllib2. Request (address) Res_data = Urllib2.urlopen (req) res = Res_data.read () pattern = Re.compile (R ' (/commend/\d{6}_\d.htm) ') Conntail = Pattern.findall (res) conntail = List (conntail[0]) conntail[16]= ' 1 ' conntail = "". Join (conntail) useragent = " mozilla/5.0 (Windows NT 6.1; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/41.0.2272.89 safari/537.36 "For I in Range (count): conn = Httplib. Httpconnection ("today.hit.edu.cn") ipAddress = "%d.%d.%d.%d"% (Random.randint (1,255), Random.randint (0,255), Random.randint (0,255), Random.randint (0,255)) headers={"x-forwarded-for": ipAddress, "user-agent": useragent} Conn.request ("HEAD", Conntail, "", Headers) Time.sleep (2) res = Conn.getresponse () print Res.status,res.reason

Inevitably someone will have doubts: Front urllib2 behind Httplib? Yes, I am a slag, so actually in the bright uncle's version of the change, the same strong C-style ...

The environment is Windows browser is Chrome #应该没什么关系吧

Use the method is to start entering the URL, and then enter the number of brush, slowly wait, as long as the speed is not too abnormal, generally a second can be brushed a vote

Today hit brush recommended Python script

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.