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接口测试实战 ...
随机推荐
- eclipse下配置Spring环境
工具: jdk1.8 win10 spring5.0 1.准备工作:下载Spring开发应用的插件,api 1.spring插件包:springsource-tool-suite-3.9.4.RELE ...
- ERP项目实施记录05
周四继续进行流程演练,把第一个销售订单的物料给领了出来,走完了"物流". 关于运用一个新系统大概会经历以下阶段: 未知--了解--熟悉--改善--依赖 未知:有期待.担心.抗拒,需 ...
- python-Beautiful rose
热爱python,热爱生活,python需要浪漫,让我带大家走进浪漫的国度...写的不好的地方请大佬指教 import turtle import time class Rose: def __ini ...
- Mac上的jdk
最近装jdk从网上找到的资料: 一.以前版本的Mac自带了的JDK6,安装在目录:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/下.* JDK7 ...
- [No000016B]清华maven库配置settings.xml
路径:"C:\Users\%USERNAME%\.m2\settings.xml" <settings xmlns="http://maven.apache.org ...
- Deck of Cards ZOJ - 2852 dp 多决策 三维 滚动更新
题意:一个特殊21点游戏 具体http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2852 题解:建一个三维dp,表示三个卡槽分别 ...
- Exception 06 : org.hibernate.NonUniqueObjectException: A different object with the same identifier value was already associated with the session :
异常名称: org.hibernate.NonUniqueObjectException: A different object with the same identifier value was ...
- CentOS 7 升级内核
升级 CentOS 内核参考资料 1 升级 CentOS 内核参考资料 2 通过 /proc 虚拟文件系统读取或配置内核 Linux 内核官网 CentOS 官网 1. 关于 Linux 内核 Lin ...
- Flink - ResultPartition
发送数据一般通过,collector.collect public interface Collector<T> { /** * Emits a record. * * @param re ...
- iOS 修改TabBar的item间距
@interface HPTabBarController ()<UITabBarControllerDelegate>//继承自UITabBarController @property ...