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接口测试实战 ...
随机推荐
- ubuntu部署安装 MySQL 5.7
安装 MySQL 5.7安装 MySQL 运行命令: apt-get -y install mysql-server mysql-client 你会被要求提供MySQL的root用户密码 : New ...
- STL学习笔记--排序算法
排序算法 C++ STL 的排序算法(Sorting algorithms)是一组将无序序列排列成有序序列的模板函数或与排序相关的模板函数,提供了排序.折半搜索.归并.集合操作.堆操作.最值求解.字典 ...
- 安装指定版本的nodejs
node有一个模块n,是专门用来管理node.js的版本的. 1.安装n模块: npm install -g n 2.升级node.js到最新稳定版 n stable 3.安装指定版本: n v6.1 ...
- pytorch定义一个简单的神经网络
刚学习pytorch,简单记录一下 """ test Funcition """ import torch from torch.autog ...
- layer开启与关闭加载层
// 开启加载层 layer.load(2, { shade: [0.6, '#fff'], content: '数据加载中...', success: function (layero) { lay ...
- [cloud][ovs][sdn] 安装 openvswitch-dpdk
[cloud][OVS][sdn] Open vSwitch 初步了解 继之前的内容,安装基于dpdk的ovs https://docs.openvswitch.org/en/latest/intro ...
- EF-CodeFirst-数据迁移
数据迁移 之前说到Code-First中有不同的数据库初始化策略,如CreateDatabaseIfNotExists,DropCreateDatabaseIfModelChanges和DropCre ...
- ECharts图形库
ECharts图形库百度的项目,图形的创建也比较简单,直接引用Javascript即可 1,引入<script src="{{ url_for("static",f ...
- 自己写的运用bootstrap和angulajs框架写的demo
登录html: <body ng-app="mainapp"> <div class="container"> <div clas ...
- java 线程 (三)线程并发的安全性 同步代码块
package cn.sasa.demo1; import java.util.concurrent.ExecutionException; public class ThreadDemo { pub ...