python接口测试-充值

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python接口测试-充值相关的知识,希望对你有一定的参考价值。

import requests
import json
import unittest
import HTMLTestRunner

telphone =18200717087 #参数化手机号码

ur1=http://--:8081/systLogonUser/adminLogon.do
headers = {Content-Type:application/x-www-form-urlencoded,Referer:118.178.247.67}
data = {
    userName:telphone ,
    pwd: 123456Aa,
    verifyCode: 121
}
r = requests.post(url=ur1,data=data,headers=headers)
repones = r.text
print(1,r.text)
print(2,r.status_code)
print(3,r.text[12:28])
fundAcc=r.text[12:28]  #获取存管=账号


custName= 严春雪   #参数化
DraweeAccNo = 6222023602807200471  #参数化
# fundAcc = 9595100066088003

ur12=http://--:10100/p2pGate/recharge/recharge.html
headers2 = {Content-Type:application/x-www-form-urlencoded,Referer:10.139.39.43:8620}
data2 = {
"Amt":"403",
"channel":"1001",
"CurrType":"RMB",
"DraweeAccName":custName, #参数化
"DraweeAccNo":DraweeAccNo, #参数化
"DraweePath":"0002",
"DraweeVoucherType":"4099",
"DraweeVoucherNo":"0000000000000000",
"enviro":0,
"FromFlag":3,
"HostPrdCode":"993010000000000000",
# "orderId":"301012015jf711174392154410${__Random(1000,9999,ord)}",
"orderId":"301012015jf7111743921544107",
"PayeeAccName":"首金存管结算户(客户资金专户)",
"PayeeAccNo":"600161178",
"Summary":fundAcc #参数化
}
r = requests.post(url=ur12,data=data2,headers=headers2)
repones = r.text
# print(‘heheda1:‘,r.text)
print(heheda2,r.status_code)
print(4,chognzhi)

 

以上是关于python接口测试-充值的主要内容,如果未能解决你的问题,请参考以下文章

Python接口自动化

Python接口自动化

postman接口测试----4学生金币充值

jmeter接口测试----11关联

Flask 编写http接口api及接口自动化测试

Python接口自动化之pymysql数据库操作