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接口测试实战 ...
随机推荐
- 汇编语言里 eax, ebx, ecx, edx, esi, edi, ebp, esp
eax, ebx, ecx, edx, esi, edi, ebp, esp等都是X86 汇编语言中CPU上的通用寄存器的名称,是32位的寄存器.如果用C语言来解释,可以把这些寄存器当作变量看待. 比 ...
- WebLogic初学笔记
这两天在公司自己摸索着用WebLogic(因为可以问的同事不多),之前一直用的是tomcat.面对一个从不了解的技术,自己摸索似乎非常背劲.后来有同事指点果然事半功倍. 项目使用WebLogic版本: ...
- 通过Rabbitmq从ipone手机传输imu和相机数据到电脑端
https://github.com/tomas789/iOSmsg_client https://github.com/tomas789/iOSmsg 通过xcode工具把iosmsg打包发布到ip ...
- 动态环境下的slam问题如何解决?
作者:颜沁睿链接:https://www.zhihu.com/question/47817909/answer/107775045来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注 ...
- 524 (Div. 2) Masha and two friends
Codeforces Round #524 (Div. 2) C. Masha and two friends 题目链接 题意:较为简单,初始给定这个白黑相交的格子,第一遍把坐标范围内的全部涂白,第二 ...
- hive优化之参数调优
1.hive参数优化之默认启用本地模式 启动hive本地模式参数,一般建议将其设置为true,即时刻启用: hive (chavin)> set hive.exec.mode.local.aut ...
- Exception 03 : org.hibernate.MappingException: Unknown entity: org.hibernate.cfg.Configuration
异常名称 org.hibernate.MappingException: Unknown entity: org.hibernate.cfg.Configuration 异常详细信息 org.hibe ...
- Entity Framework 6如何进行导航属性的筛选(context.Msg.First(t=>t.Id==1).Include(t=>t.MsgDetail),筛选MsgDetail带条件)
问题: https://q.cnblogs.com/q/98333/ Msg表(Id,Content,IsDel).内有 virtual ICollection<MsgDetail> Ms ...
- [daily][btrfs][mlocate][updatedb] mlocate不认识btrfs里面的文件
这是mlocate的一个bug, 截至到目前还没有修复, 至少在redhat上没有修复. https://bugzilla.redhat.com/show_bug.cgi?id=906591 解决方法 ...
- hash_map
点开一道第是自己oj的第440大关,想a了,一直想却无果,学长一句点醒,开始写hash. 关于这道题呢很无语了,两天卡在这上面,而且有些dalao不到20min就a了.我太菜了. 所以要深入讨论这道题 ...