使用python对post接口进行测试

①安装requests

在cmd中,pip install requests

②pycharm中导入

file-->setting-->添加

④编码如下:

#coding=utf-8

import requests

import json

base_url='*******'

url=base_url+'/pp/v1/Client/LoginReg/sendSms'

print url

bodyData= {"phone": 13250772191

}

date_json = json.dumps(bodyData)

r = requests.post(url, data=date_json)

print r.json()

猜你喜欢

转载自www.cnblogs.com/wx921308494/p/11963781.html
今日推荐