recharge.py
1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
"""
卡片充值
"""
from commons import common as com
from commons.MySession import hg
from commons.basic.duplicateToken import duplicateToken
class recharge():
url = "http://test.gateway.diligrp.com:8285/card-web/fund/recharge.action"
header = {
"UAP_accessToken":"demo",
"UAP_refreshToken":"demo",
"duplicate_commit_token": "demo",
"Content-Type":"application/json;charset=utf-8",
"Host":"test.gateway.diligrp.com:8285",
"Content-Length":"740" }
# body = {"amount":500000000,"cardNo":"888810043394","accountId":107791,"customerId":141995,"tradePwd":"","tradeChannel":2}
body = {"amount":500000000,"cardNo":"888810026785","accountId":107792,"customerId":141992,"tradePwd":"","tradeChannel":2}
def __init__(self,market):
self.market = market
self.url = recharge.url.replace("http://test.",com.get_global_config("global_data", "environment", "en") )
self.header = recharge.header
self.header["UAP_accessToken"] = self.market.cookies["UAP_accessToken"]
self.header["UAP_refreshToken"] = self.market.cookies["UAP_refreshToken"]
self.body = recharge.body
def refresh_commit_token(self):
self.header["duplicate_commit_token"] = duplicateToken(self.market).duplicate_commit_token()
tt = recharge(hg)
for i in range(0,100):
tt.refresh_commit_token()
hg.post(url=tt.url, json=tt.body, headers=tt.header, proxies=hg.myproxies)