python实现接口测试

# -*- coding: cp936 -*-
import requests
import json

def test_memberCode_add():
    url = "http://119.29.183.114:8006/admin/members/member/applyMemberCodeList"    #测试的接口url
    headers = {"Content-Type":"Text/json","pagodaRequestKey":"b0e3202f-0825-4a6d-9a60-b5a5e785d403"}
    data = {           #接口传送的参数
           "head": {
                     "sender": "A",
                      "senderValue": "",
                      "operator": ""
                                           },
            "memberId":100000670,

                                               }
    r = requests.post(url=url,data=json.dumps(data),headers=headers)    #发送请求
    #return r.json
    print (r.text)   #获取响应报文

if __name__=="__main__":
    test_memberCode_add()

你可能感兴趣的:(python实现接口测试)