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

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):
        self.url = weighingServiceSave.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
        self.header = weighingServiceSave.header
        self.header["jmsf_duplicate_commit_token"] = du.jmsf_duplicate_commit_token()
        self.header["UAP_accessToken"] = sy1.cookies["UAP_accessToken"]
        self.header["UAP_refreshToken"] = sy1.cookies["UAP_refreshToken"]
        self.header["UAP_firmId"] = sy1.cookies["UAP_firmId"]
        self.header["Host"] = com.get_global_config("global_data", "host", "gateway")



# tt=weighingServiceSave()
# re=sy1.post(url=tt.url,headers=tt.header,json=tt.body,proxies=my.myproxies)
# # print(re.json())