duplicateToken.py
1.3 KB
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import urllib3
from commons import common as com
from commons.MySession import my,sy1
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
class duplicateToken():
"称重防重接口,返回唯一的commit_token"
url = "http://test.gateway.diligrp.com:8285/jmsf-web/appCommon/duplicateToken.action"
header = {
"UAP_accessToken": "demo",
"UAP_refreshToken": "demo",
"UAP_firmId": "9",
"Host": "test.gateway.diligrp.com:8285",
"Connection":"Keep-Alive"}
def __init__(self,market):
self.market=market
self.url = duplicateToken.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
self.header = duplicateToken.header
self.header["UAP_accessToken"] = self.market.cookies["UAP_accessToken"]
self.header["UAP_refreshToken"] = self.market.cookies["UAP_refreshToken"]
self.header["UAP_firmId"] = self.market.cookies["UAP_firmId"]
self.header["Host"] = com.get_global_config("global_data", "host", "gateway")
def jmsf_duplicate_commit_token(self):
re = self.market.get(url=self.url, headers=self.header)
return re.json()["data"]
# print(duplicateToken(sy1).jmsf_duplicate_commit_token())