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('1',r.text) print('2',r.status_code) print('3',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":"403", "channel":"1001", "CurrType":"RMB", "DraweeAccName":custName, #参数化 "DraweeAccNo":DraweeAccNo, #参数化 "DraweePath":"0002", "DraweeVoucherType":"4099", "DraweeVoucherNo":"0000000000000000", "enviro":0, "FromFlag":3, "HostPrdCode":"993010000000000000", # "orderId":"301012015jf711174392154410${__Random(1000,9999,ord)}", "orderId":"301012015jf7111743921544107", "PayeeAccName":"首金存管结算户(客户资金专户)", "PayeeAccNo":"600161178", "Summary":fundAcc #参数化 } r = requests.post(url=ur12,data=data2,headers=headers2) repones = r.text # print('heheda1:',r.text) print('heheda2',r.status_code) print('4','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('1',r.text) print('2',r.status_code) print('3',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":"408", "channel":"1001", "CurrType":"RMB", # "DraweeAccName":custName, #参数化 "DraweeAccName":name, #参数化 "DraweeAccNo":DraweeAccNo, #参数化 "DraweePath":"0002", "DraweeVoucherType":"4099", "DraweeVoucherNo":"0000000000000000", "enviro":0, "FromFlag":3, "HostPrdCode":"993010000000000000", # "orderId":"301012015jf711174392154410${__Random(1000,9999,ord)}", "orderId":"301012015jf7111743921544107", "PayeeAccName":"首金存管结算户(客户资金专户)", "PayeeAccNo":"600161178", "Summary":fundAcc #参数化 } r = requests.post(url=ur12,data=data2,headers=headers2) repones = r.text # print('heheda1:',r.text) print('heheda2',r.status_code) print('4','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('1',r.text) print('2',r.status_code) print('3',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":"1001", "CurrType":"RMB", # "DraweeAccName":custName, #参数化 "DraweeAccName":name, #参数化 "DraweeAccNo":DraweeAccNo, #参数化 "DraweePath":"0002", "DraweeVoucherType":"4099", "DraweeVoucherNo":"0000000000000000", "enviro":0, "FromFlag":3, "HostPrdCode":"993010000000000000", # "orderId":"301012015jf711174392154410${__Random(1000,9999,ord)}", "orderId":"301012015jf7111743921544107", "PayeeAccName":"首金存管结算户(客户资金专户)", "PayeeAccNo":"600161178", "Summary":fundAcc #参数化 } r = requests.post(url=ur12,data=data2,headers=headers2) repones = r.text # print('heheda1:',r.text) #会打印出各字段的内容 print('heheda2',r.status_code) print('4','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='622202360280720' 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('1',r.text) print('2',r.status_code) print('3',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":"1001", "CurrType":"RMB", # "DraweeAccName":custName, #参数化 "DraweeAccName":name, #参数化 "DraweeAccNo":DraweeAccNo, #参数化 "DraweePath":"0002", "DraweeVoucherType":"4099", "DraweeVoucherNo":"0000000000000000", "enviro":0, "FromFlag":3, "HostPrdCode":"993010000000000000", # "orderId":"301012015jf711174392154410${__Random(1000,9999,ord)}", "orderId":"301012015jf7111743921544107", "PayeeAccName":"首金存管结算户(客户资金专户)", "PayeeAccNo":"600161178", "Summary":fundAcc #参数化 } r = requests.post(url=ur12,data=data2,headers=headers2) repones = r.text # print('heheda1:',r.text) #会打印出各字段的内容 print('heheda2',r.status_code) print('4','chognzhi')