Commit bb5954209f85f665c954b9ceabf48ef05aefa1f6
1 parent
30355be4
更新文件
Showing
4 changed files
with
73 additions
and
0 deletions
commons/basic/duplicateToken.py
0 → 100644
1 | +#!/usr/bin/python | |
2 | +# -*- coding: UTF-8 -*- | |
3 | +import urllib3 | |
4 | +from commons import common as com | |
5 | +from commons.MySession import hg | |
6 | +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
7 | + | |
8 | + | |
9 | +class duplicateToken(): | |
10 | + "称重防重接口,返回唯一的commit_token" | |
11 | + url = "http://test.gateway.diligrp.com:8285/card-web/appCommon/duplicateToken.action" | |
12 | + header = { | |
13 | + "UAP_accessToken": "demo", | |
14 | + "UAP_refreshToken": "demo", | |
15 | + "UAP_firmId": "9", | |
16 | + "Host": "test.gateway.diligrp.com:8285", | |
17 | + "Connection":"Keep-Alive"} | |
18 | + | |
19 | + def __init__(self,market): | |
20 | + self.market=market | |
21 | + self.url = duplicateToken.url.replace("http://test.", com.get_global_config("global_data", "environment", "en")) | |
22 | + self.header = duplicateToken.header | |
23 | + self.header["UAP_accessToken"] = self.market.cookies["UAP_accessToken"] | |
24 | + self.header["UAP_refreshToken"] = self.market.cookies["UAP_refreshToken"] | |
25 | + self.header["UAP_firmId"] = self.market.cookies["UAP_firmId"] | |
26 | + | |
27 | + | |
28 | + def duplicate_commit_token(self): | |
29 | + re = self.market.get(url=self.url, headers=self.header) | |
30 | + return re.json()["data"] | |
31 | + | |
32 | + | |
33 | +# print(duplicateToken(hg).duplicate_commit_token()) | ... | ... |
commons/basic/recharge.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | + | |
3 | +""" | |
4 | +卡片充值 | |
5 | +""" | |
6 | + | |
7 | +from commons import common as com | |
8 | +from commons.MySession import hg | |
9 | +from commons.basic.duplicateToken import duplicateToken | |
10 | + | |
11 | +class recharge(): | |
12 | + url = "http://test.gateway.diligrp.com:8285/card-web/fund/recharge.action" | |
13 | + header = { | |
14 | + "UAP_accessToken":"demo", | |
15 | + "UAP_refreshToken":"demo", | |
16 | + "duplicate_commit_token": "demo", | |
17 | + "Content-Type":"application/json;charset=utf-8", | |
18 | + "Host":"test.gateway.diligrp.com:8285", | |
19 | + "Content-Length":"740" } | |
20 | + | |
21 | + # body = {"amount":500000000,"cardNo":"888810043394","accountId":107791,"customerId":141995,"tradePwd":"","tradeChannel":2} | |
22 | + body = {"amount":500000000,"cardNo":"888810026785","accountId":107792,"customerId":141992,"tradePwd":"","tradeChannel":2} | |
23 | + | |
24 | + def __init__(self,market): | |
25 | + self.market = market | |
26 | + self.url = recharge.url.replace("http://test.",com.get_global_config("global_data", "environment", "en") ) | |
27 | + self.header = recharge.header | |
28 | + self.header["UAP_accessToken"] = self.market.cookies["UAP_accessToken"] | |
29 | + self.header["UAP_refreshToken"] = self.market.cookies["UAP_refreshToken"] | |
30 | + self.body = recharge.body | |
31 | + | |
32 | + | |
33 | + def refresh_commit_token(self): | |
34 | + self.header["duplicate_commit_token"] = duplicateToken(self.market).duplicate_commit_token() | |
35 | + | |
36 | +tt = recharge(hg) | |
37 | +for i in range(0,100): | |
38 | + tt.refresh_commit_token() | |
39 | + hg.post(url=tt.url, json=tt.body, headers=tt.header, proxies=hg.myproxies) | |
40 | + | ... | ... |
testcase/hg/loan_generalCustomer/__init__.py
0 → 100644
testcase/hg/loan_vipCustomer/__init__.py
0 → 100644