python接口自动化

第一个接口自动化程序

数据都是字典格式

import unittest
import requests
import json
url='http://m.wconcept.cn/api/rest/wcc/login/v2'
header={"Content-Type":"application/json;charset=UTF-8"
,"Accept-Encoding	br,gzip,":"deflate"
,"User-Agent":"wcc/3.9.5 (iPhone; iOS 10.3.2; Scale/3.00"
,"Accept":"*/*"}
data={
 "mobile": "user",
 "password": "pwd",
 "device_uid": "17EDF3F0-F0B7-498B-84A5-E67CBABB06C6",
 "loginType": "3"
}
req=requests.post(url=url,json=data,headers=header).text

装json格式

print(type(req))
data=json.loads(req)
print(data)

 

你可能感兴趣的:(python,接口自动化)