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接口测试-充值的更多相关文章

  1. Python接口测试实战1(上)- 接口测试理论

    如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...

  2. Python接口测试实战4(下) - 框架完善:用例基类,用例标签,重新运行上次失败用例

    如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...

  3. Python接口测试实战5(上) - Git及Jenkins持续集成

    如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...

  4. Python接口测试实战5(下) - RESTful、Web Service及Mock Server

    如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...

  5. Python接口测试实战4(上) - 接口测试框架实战

    如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...

  6. Python接口测试实战3(下)- unittest测试框架

    如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...

  7. Python接口测试实战3(上)- Python操作数据库

    如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...

  8. Python接口测试实战2 - 使用Python发送请求

    如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...

  9. Python接口测试实战1(下)- 接口测试工具的使用

    如有任何学习问题,可以添加作者微信:lockingfree 课程目录 Python接口测试实战1(上)- 接口测试理论 Python接口测试实战1(下)- 接口测试工具的使用 Python接口测试实战 ...

随机推荐

  1. ssh登录慢解决办法

    这两天ssh登录局域网的一台服务器非常慢,严重影响工作效率,怎么办?查了一下网上的解决办法,总结一下: 使用命令ssh -v xxx@x.x.x.x 可以看到debug信息,找到问题出在哪: debu ...

  2. win10 远程出现身份验证错误 要求的函数不受支持

    win10的一个更新的bug 解决方案 http://note.youdao.com/noteshare?id=68aa9de9fbf46c50a097b3ccf7994580&sub=5AF ...

  3. 读《Spring源码深度解析》途中问题1

    step 1:检查自己的eclipse版本:在help->About Eclipse中查看: step 2:进入 https://github.com/groovy/groovy-eclipse ...

  4. [No0000151]菜鸟理解.NET Framework中的CLI,CLS,CTS,CLR,FCL,BCL

    最下层蓝色部分是.NET Framework的基础,也是所有应用软件的基础..NET Framework不是凭空出来的,实际上API,COM+,和一些相关驱动依然是它的基石..NET Framewor ...

  5. 利用win10自带的虚拟机Hyper-V安装Centos7的步骤教程

    1.设置开启Hyper-V应用程序? 在搜索功能里输入 Hyper-V 然后点击选中的部分 2.全部选中框中的部分,然后重新启动电脑 3.在搜索功能里输入Hyper-V 打开 4.点击新建--> ...

  6. hive拉链表

    前言 本文将会谈一谈在数据仓库中拉链表相关的内容,包括它的原理.设计.以及在我们大数据场景下的实现方式. 全文由下面几个部分组成:先分享一下拉链表的用途.什么是拉链表.通过一些小的使用场景来对拉链表做 ...

  7. yum下载rpm包

    方法一:downloadonly插件 1.安装插件 yum -y install yum-download  2.下载httpd软件包到当前文件夹内 yum -y install httpd -dow ...

  8. PHP之PSR

    PHP的PSR (PSR 称为PHP Standard Recommendations) PSR参考网址:http://www.php-fig.org/psr 在PHP中,有5个编码标准分类: ①.P ...

  9. 洛谷P3567 KUR-Couriers [POI2014] 主席树/莫队

    正解:主席树/莫队 解题报告: 传送门! 这题好像就是个主席树板子题的样子,,,? 毕竟,主席树的最基本的功能就是,维护一段区间内某个数字的个数 但是毕竟是刚get到主席树,然后之前做的一直是第k大, ...

  10. MongoDB update修改器: 针对Arrays的$修改器 $push $pull $pop

    针对Arrays的$修改器 $push : { $push: { key: value } } 它是用来对Array (list)数据类型进行 增加 新元素的,相当于我们Python中 list.ap ...