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('',r.text)
print('',r.status_code)
print('',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":"",
"channel":"",
"CurrType":"RMB",
"DraweeAccName":custName, #参数化
"DraweeAccNo":DraweeAccNo, #参数化
"DraweePath":"",
"DraweeVoucherType":"",
"DraweeVoucherNo":"",
"enviro":0,
"FromFlag":3,
"HostPrdCode":"",
# "orderId":"301012015jf711174392154410${__Random(1000,9999,ord)}",
"orderId":"301012015jf7111743921544107",
"PayeeAccName":"首金存管结算户(客户资金专户)",
"PayeeAccNo":"",
"Summary":fundAcc #参数化
}
r = requests.post(url=ur12,data=data2,headers=headers2)
repones = r.text
# print('heheda1:',r.text)
print('heheda2',r.status_code)
print('','chognzhi')
连接数据库参数化
import requests
import json
import unittest
import HTMLTestRunner
import pymysql telphone =18200717087 #参数化手机号码
DraweeAccNo = 6222023602807200471 #参数化 mydb =pymysql.connect(host = 'rm-bp1uhprrba0h47ry4.mysql.rds.aliyuncs.com',user = 'core_mgt',passwd = 'core_mgt_pwd666',port=3306,database ='user',charset='utf8' )
mycursor = mydb.cursor()
# sql ="SELECT * FROM user.t_user_info where phone_tel = '18200717087' "
# sql ="SELECT id FROM user.t_user_info where phone_tel = '18200717087' "
sql = "SELECT b.cust_full_name FROM user.t_user_cust_info b , user.t_user_info a where a.id = b.user_id and a.phone_tel =18200717087;"
mycursor.execute(sql)
myresult =mycursor.fetchall()
for x in myresult:
print(x)
name = x[0]
print(name) ur1='http://118.178.247.67: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('',r.text)
print('',r.status_code)
print('',r.text[12:28])
fundAcc=r.text[12:28] #获取存管=账号 # custName= '严春雪' #参数化
# DraweeAccNo = 6222023602807200471 #参数化
# fundAcc = 9595100066088003 ur12='http://111.205.207.103:10100/p2pGate/recharge/recharge.html'
headers2 = {'Content-Type':'application/x-www-form-urlencoded','Referer':'10.139.39.43:8620'}
data2 = {
"Amt":"",
"channel":"",
"CurrType":"RMB",
# "DraweeAccName":custName, #参数化
"DraweeAccName":name, #参数化
"DraweeAccNo":DraweeAccNo, #参数化
"DraweePath":"",
"DraweeVoucherType":"",
"DraweeVoucherNo":"",
"enviro":0,
"FromFlag":3,
"HostPrdCode":"",
# "orderId":"301012015jf711174392154410${__Random(1000,9999,ord)}",
"orderId":"301012015jf7111743921544107",
"PayeeAccName":"首金存管结算户(客户资金专户)",
"PayeeAccNo":"",
"Summary":fundAcc #参数化
}
r = requests.post(url=ur12,data=data2,headers=headers2)
repones = r.text
# print('heheda1:',r.text)
print('heheda2',r.status_code)
print('','chognzhi')
向sql中传参telphone
import requests
import json
import unittest
import HTMLTestRunner
import pymysql telphone = 18200717087 #手机号,参数化手机号码
money = 412 #充值金额
DraweeAccNo = 6222023602807200471 #银行卡号,参数化 mydb =pymysql.connect(host = 'rm-bp1uhprrba0h47ry4.mysql.rds.aliyuncs.com',user = 'core_mgt',passwd = 'core_mgt_pwd666',port=3306,database ='user',charset='utf8' )
mycursor = mydb.cursor()
# sql ="SELECT * FROM user.t_user_info where phone_tel = '18200717087' "
# sql ="SELECT id FROM user.t_user_info where phone_tel = '18200717087' "
sql = "SELECT b.cust_full_name FROM user.t_user_cust_info b , user.t_user_info a where a.id = b.user_id and a.phone_tel ={0};".format(telphone)
mycursor.execute(sql)
myresult =mycursor.fetchall()
for x in myresult:
print(x)
name = x[0]
print(name) #登录接口
ur1='http://118.178.247.67: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('',r.text)
print('',r.status_code)
print('',r.text[12:28])
fundAcc=r.text[12:28] #获取存管=账号
# custName= '严春雪' #参数化
# DraweeAccNo = 6222023602807200471 #参数化
# fundAcc = 9595100066088003 #充值接口
ur12='http://111.205.207.103:10100/p2pGate/recharge/recharge.html'
headers2 = {'Content-Type':'application/x-www-form-urlencoded','Referer':'10.139.39.43:8620'}
data2 = {
"Amt":money,
"channel":"",
"CurrType":"RMB",
# "DraweeAccName":custName, #参数化
"DraweeAccName":name, #参数化
"DraweeAccNo":DraweeAccNo, #参数化
"DraweePath":"",
"DraweeVoucherType":"",
"DraweeVoucherNo":"",
"enviro":0,
"FromFlag":3,
"HostPrdCode":"",
# "orderId":"301012015jf711174392154410${__Random(1000,9999,ord)}",
"orderId":"301012015jf7111743921544107",
"PayeeAccName":"首金存管结算户(客户资金专户)",
"PayeeAccNo":"",
"Summary":fundAcc #参数化
}
r = requests.post(url=ur12,data=data2,headers=headers2)
repones = r.text
# print('heheda1:',r.text) #会打印出各字段的内容
print('heheda2',r.status_code)
print('','chognzhi')
连接oracle数据库参数化卡号
import requests
import json
import unittest
import HTMLTestRunner
import pymysql
import cx_Oracle # 解决oracle查看汉字乱码的问题
import os
os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8' telphone = 18200717087 #手机号,参数化手机号码
money = 414 #充值金额 # 参数化
# DraweeAccNo = 6222023602807200471 #银行卡号,参数化
mydb=cx_Oracle.connect("finser/finser2015X@//10.139.39.43:1524/sjw2")
mycursor = mydb.cursor()
sql = "select t.bank_no from CLEA_BANK_BIND_INFO t where phone_no ='{0}'".format(telphone)
mycursor.execute(sql)
myresult =mycursor.fetchall()
for x in myresult:
print(x)
#取出卡号
a=x[0]
print(a)
# 取卡号的后四位
a1=a[15:19]
print(a1)
# 拼接卡号
b=''
DraweeAccNo=b+a1
print(DraweeAccNo) #连接msql数据库
mydb =pymysql.connect(host = 'rm-bp1uhprrba0h47ry4.mysql.rds.aliyuncs.com',user = 'core_mgt',passwd = 'core_mgt_pwd666',port=3306,database ='user',charset='utf8' )
mycursor = mydb.cursor()
# sql ="SELECT * FROM user.t_user_info where phone_tel = '18200717087' "
# sql ="SELECT id FROM user.t_user_info where phone_tel = '18200717087' "
sql = "SELECT b.cust_full_name FROM user.t_user_cust_info b , user.t_user_info a where a.id = b.user_id and a.phone_tel ={0};".format(telphone)
mycursor.execute(sql)
myresult =mycursor.fetchall()
for x in myresult:
print(x)
name = x[0]
print(name) #登录接口
ur1='http://118.178.247.67: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('',r.text)
print('',r.status_code)
print('',r.text[12:28])
fundAcc=r.text[12:28] #获取存管=账号
# custName= '严春雪' #参数化
# DraweeAccNo = 6222023602807200471 #参数化
# fundAcc = 9595100066088003 #充值接口
ur12='http://111.205.207.103:10100/p2pGate/recharge/recharge.html'
headers2 = {'Content-Type':'application/x-www-form-urlencoded','Referer':'10.139.39.43:8620'}
data2 = {
"Amt":money,
"channel":"",
"CurrType":"RMB",
# "DraweeAccName":custName, #参数化
"DraweeAccName":name, #参数化
"DraweeAccNo":DraweeAccNo, #参数化
"DraweePath":"",
"DraweeVoucherType":"",
"DraweeVoucherNo":"",
"enviro":0,
"FromFlag":3,
"HostPrdCode":"",
# "orderId":"301012015jf711174392154410${__Random(1000,9999,ord)}",
"orderId":"301012015jf7111743921544107",
"PayeeAccName":"首金存管结算户(客户资金专户)",
"PayeeAccNo":"",
"Summary":fundAcc #参数化
}
r = requests.post(url=ur12,data=data2,headers=headers2)
repones = r.text
# print('heheda1:',r.text) #会打印出各字段的内容
print('heheda2',r.status_code)
print('','chognzhi')
python接口测试-充值的更多相关文章
- Python接口测试实战1(上)- 接口测试理论
如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...
- Python接口测试实战4(下) - 框架完善:用例基类,用例标签,重新运行上次失败用例
如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...
- Python接口测试实战5(上) - Git及Jenkins持续集成
如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...
- Python接口测试实战5(下) - RESTful、Web Service及Mock Server
如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...
- Python接口测试实战4(上) - 接口测试框架实战
如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...
- Python接口测试实战3(下)- unittest测试框架
如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...
- Python接口测试实战3(上)- Python操作数据库
如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...
- Python接口测试实战2 - 使用Python发送请求
如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...
- Python接口测试实战1(下)- 接口测试工具的使用
如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...
随机推荐
- C语言迷题:有符号数与无符号数的问题(转)
https://my.oschina.net/kelvinfang/blog/134725
- poj3376 Finding Palindromes【exKMP】【Trie】
Finding Palindromes Time Limit: 10000MS Memory Limit: 262144K Total Submissions:4710 Accepted: 8 ...
- css学习_文本有关的样式属性、sublime快捷生成标签
1.css中color定义文本的颜色 写法:(最常用的是16进制的) 2.行间距 line-height 3.水平对齐方式 text-align left right center 4.首 ...
- okvis论文解读
C. Keypoint Matching and Keyframe Selection 我们的处理流程采用定制的多尺度SSE优化Harris角点检测器与BRISK描述符提取相结合[12].检测器通过逐 ...
- mysql日期格式转换,如何保持原日期?CONVERT/Substring 函数截取。replace替换
http://www.cnblogs.com/stevenjson/p/3729577.html CONVERT(varchar(100), getdate(), 112)这种, 问题就出在getda ...
- tensorflow的tile使用
当你需要按照矩阵维度复制数据时候,可以使用tensorflow的tile函数 a1 = tf.tile(a, [2, 2]) 表示把a的第一个维度复制两次,第二个维度复制2次.注意使用tf.nn.so ...
- [development][security][modsecurity][nginx] nginx / modsecurity development things
接续前节:[security][modsecurity][nginx] nginx 与 modsecurity nginx开发手册:https://nginx.org/en/docs/dev/deve ...
- [dpdk] SDK编译配置
前言: dpdk-16.07.2 与 内核Linux-3.10.0-514.6.1.el7.x86_64 编译的时候有个关于kni的错误 CC [M] /root/src/thirdparty/dpd ...
- Delphi2010分 AnsiChar(1个字节) 和WideChar(2个字节) 。D7都是AnsiChar。
Delphi2010分 AnsiChar(1个字节) 和WideChar(2个字节) .D7都是AnsiChar.
- 安装graphlab伤透了心,终于搞定了
为了方便研究各种机器学习算法,我想用graphlab来辅助我对后续算法的研究.所以我的目标就是安装graphlab到我的windows笔记本中.而基于python的graphlab的安装最好是采用如下 ...