python找人脚本_python 自动刷人气脚本

这是一个使用Python编写的自动化脚本,主要用于模拟多人绑定操作。脚本通过POST请求向指定URL发送数据,进行商品与电子标签(eslid)的绑定,并使用多线程分别处理多个文件中的eslid数据。每个线程处理一个文件,包括jb1到jb6,每个文件可能包含不同的eslid和sku信息。脚本中包含了登录、绑定操作以及必要的延迟策略,以防止过于频繁的请求。
摘要由CSDN通过智能技术生成

公司安总让小弟做多人模拟绑定,于是就有了下文,非常简单,可以改下url做自动刷人气脚本

代码如下,请不要见笑

#-*- coding:utf-8 -*-

import requests, json, sqlite3, random,time,threading

from time import ctime

class BindOp(object):

def __init__(self):

global cookies

logindata = {

"username": "001",

"password": "000000"

}

s = requests.post("http://192.168.4.88:8080/shopweb/login",logindata)

cookies = s.cookies

print cookies

time.sleep(3)

def jb1(self):

print 'jb1 start' +ctime()

n = 0

jb1_eslid = open(r".\eslid1.txt").readlines()#数据格式为eslid+sku。eslid在前,sku号在后,中间不需要空格

for i in jb1_eslid:

n = n +1

i = i.strip('\n')

k = requests.post("http://192.168.4.88:8080/shopweb/bind",data=str([{"eslId": i[0:11],"goodsId":i[11:]}]),cookies = cookies)

print k.json()

time.sleep(6)

print 'jb1 over' +ctime()

def jb2(self):

print 'jb2 start' +ctime()

jb2_eslid = open("..\jb2\eslid2.txt").readlines() #脚本2的eslid

n = 0

for i in jb2_eslid:

n = n +1

i = i.strip('\n')

k = requests.post("http://192.168.4.88:8080/shopweb/bind",data=str([{"eslId": i[0:11],"goodsId":i[11:]}]),cookies = cookies)

print k.json()

time.sleep(6)

print 'jb2 over' +ctime()

def jb3(self):

n = 0

print 'jb3 start' +ctime()

time.sleep(1)

try:

jb3_eslid = open("..\jb3\eslid3.txt").readlines() #脚本3的eslid

for i in jb3_eslid:

n = n +1

i = i.strip('\n')

k = requests.post("http://192.168.4.88:8080/shopweb/bind",data=str([{"eslId": i[0:11],"goodsId":i[11:]}]),cookies = cookies)

print k.json()

time.sleep(6)

except:

print 'error,jb3 have been over,please try again'

finally:

print 'jb3 over' +ctime()

def jb4(self):

print 'jb4 start' +ctime()

n = 0

jb4_eslid = open("..\jb4\eslid4.txt").readlines() #脚本4的eslid

time.sleep(1)

for i in jb4_eslid:

n = n +1

i = i.strip('\n')

k = requests.post("http://192.168.4.88:8080/shopweb/bind",data=str([{"eslId": i[0:11],"goodsId":i[11:]}]),cookies = cookies)

print k.json()

time.sleep(6)

print 'jb4 over' +ctime()

def jb5(self):

print 'jb5 start' +ctime()

n = 0

jb5_eslid = open("..\jb5\eslid5.txt").readlines() #脚本5的eslid

time.sleep(1)

for i in jb5_eslid:

n = n +1

i = i.strip('\n')

k = requests.post("http://192.168.4.88:8080/shopweb/bind",data=str([{"eslId": i[0:11],"goodsId":i[11:]}]),cookies = cookies)

print k.json()

time.sleep(6)

print 'jb5 over' +ctime()

def jb6(self):

print 'jb6 start' +ctime()

n = 0

jb6_eslid = open("..\jb6\eslid6.txt").readlines() #脚本6的eslid

time.sleep(1)

for i in jb6_eslid:

n = n +1

i = i.strip('\n')

k = requests.post("http://192.168.4.88:8080/shopweb/bind",data=str([{"eslId": i[0:11],"goodsId":i[11:]}]),cookies = cookies)

print k.json()

time.sleep(6)

print 'jb6 over' +ctime()

def process(self):

threads = []

t1 = threading.Thread(target=BindOp.jb1,args=(self,))

threads.append(t1)

t2 = threading.Thread(target=BindOp.jb2,args=(self,))

threads.append(t2)

t3 = threading.Thread(target=BindOp.jb3,args=(self,))

threads.append(t3)

t4 = threading.Thread(target=BindOp.jb4,args=(self,))

threads.append(t4)

t5 = threading.Thread(target=BindOp.jb5,args=(self,))

threads.append(t5)

t6 = threading.Thread(target=BindOp.jb6,args=(self,))

threads.append(t6)

for tt in threads:

tt.start()

if __name__ == '__main__':

P= BindOp().process()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值