标签:head htm job rom code 测试过程 post runners imp
在测试过程中,需要进行团体报名,需要测试报名的最高上限数量,以及分页,若一个个进行报名,很浪费时间和精力,我们想到使用python语言编写代码来实现。
import requests
header ={
"authorization": "cbafcba131318a4112f82743c8b08f0b3f655cd1",
"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15"
}
def apply(name, cardNumber):
applyData = {
"pName": name,
"gender": 1,
"country": 344,
"identType": 2,
"identCard": cardNumber,
"birthDate": "1993-06-03",
"phone": "100000000",
"email": "x@b.am",
"bloodType": "A",
"province": "上海市",
"city": "黄浦区",
"Address": "ceshi",
"emergency": "dd",
"emergencyPhone": "15811540163",
"job": 1,
"education": 1,
"income": "5万以内",
"matchEventID": "5192974392788471",
"teamID": 5210251418835258,
"runnerSource": 2
}
applyUrl = "https://saas-user-gw-test.mararun.com/v1/application/apply"
try:
request = requests.post(url = applyUrl, headers=header,data = applyData)
print("status_code = %s" %request.status_code)
print(request.json())
except Exception as e:
print(e)
for i in range(100,152):
print("i=",i)
name = "testName"+ str(i)
cardNumber = i
apply(name, cardNumber)
print("-----------------")
标签:head htm job rom code 测试过程 post runners imp
原文地址:https://www.cnblogs.com/tianpin/p/11121066.html