weighingServiceSave.py 2.33 KB
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import urllib3
from commons import common as com
from commons.MySession import my,sy1,heb
from commons.basic.duplicateToken import duplicateToken
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)


class weighingServiceSave():
    "称重服务"
    url = "http://test.gateway.diligrp.com:8285/jmsf-web/api/entrace/weighingServiceSave"
    header = {
            "jmsf_duplicate_commit_token": "demo",
            "UAP_accessToken": "demo",
            "UAP_refreshToken": "demo",
            "UAP_firmId": "9",
            "Content-Type": "application/json",
            "Host": "test.gateway.diligrp.com:8285",
            "Content-Length": "453"}
    body = {
            "carTypeId": 128,
            "carTypeName": "玉玺",
            "carTypeCode": "888",
            "driverTel": "16111111111",
            "fee": "18.00",
            "greeterId": 0,
            "greeterName": None,
            "plate": "京A666666",
            "remark": "test_称重服务接口测试",
            "weighImgs": [],
            "weight": 10.0,
            "weightDate": "2021-07-29 15:50:26",
            "pathAddress": "40-5B-D8-DF-CA-C7",
            "entryPlateInputType": 1,
            "customerType": 0,
            "carryStatus": 0,
            "customerName": None,
            "pwd": "",
            "totalPrice": 18.00,
            "ic": "",
            "customerId": 0,
            "accountId": 0,
            "protocolId": None}

    def __init__(self,market):
        self.market=market
        self.url = weighingServiceSave.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
        self.header = weighingServiceSave.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 refresh_commit_token(self):
        self.header["jmsf_duplicate_commit_token"] = duplicateToken(self.market).jmsf_duplicate_commit_token()



# tt=weighingServiceSave(heb)
# tt.refresh_commit_token()
# re=heb.post(url=tt.url,headers=tt.header,json=tt.body)
# print(re.json())
# print(heb.user.sort())
# print(sy1.user.sort())