import json
from pip._vendor import requests
headers = {
"token" :"token信息",
"User-Agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 15_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.18(0x1800122c) NetType/WIFI Language/zh_CN",
"Accept-Encoding":"gzip",
"Accept-Language":"zh-CN,zh;q=0.9",
"Content-Type":"application/json",
"Content-Length":"129"
}
data={
"lotteryActivitySendId":"75",
"openId":"小程序iopenid",
"codeCount":1
}
n = 0
while n < 21:
# 抽奖接口
url = "抽奖接口"
luckyUrl = requests.post(url=url, data=json.dumps(data),headers=headers)
print(luckyUrl)
with open('C:/Users/Lenovo/Desktop/choujiang/choujiang.txt', 'a+', encoding='utf-8') as f:
print(luckyUrl.text, file=f)
print('--------------------\n', file=f)
print("这是第"+str(n+1) +"次")
n+=1
|