fieldConfig.py 2.67 KB
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import requests
import json
import urllib3
from commons import common as com
from commons.MySession import my
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

class fieldConfig():
    
    url="http://test.trace.diligrp.com:8393/fieldConfig/doUpdate.action"
    header={
            "Host": "test.trace.diligrp.com:8393",
            "Connection": "keep-alive",
            "Content-Length": "1378",
            "Accept": "application/json,text/javascript,*/*;q=0.01",
            "X-Requested-With": "XMLHttpRequest",
            "User-Agent": "Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/91.0.4472.77Safari/537.36",
            "Content-Type": "application/json",
            "Origin": "http://test.trace.diligrp.com:8393",
            "Referer": "http://test.trace.diligrp.com:8393/fieldConfig/bill.html",
            "Accept-Encoding": "gzip,deflate",
            "Accept-Language": "zh-CN,zh-TW;q=0.9,zh;q=0.8,en;q=0.7"}
    
    body={"moduleType":"1","marketId":"8","fieldConfigDetailList":[{"fieldName":"unitPrice","jsonPath":"$.unitPrice","defaultId":"3","displayed":"1","required":"0"},{"fieldName":"arrivalTallynos","jsonPath":"$.arrivalTallynos","defaultId":"10","displayed":"1","required":"0"},{"fieldName":"brandName","jsonPath":"$.brandName","defaultId":"5","displayed":"1","required":"0"},{"fieldName":"truckTareWeight","jsonPath":"$.truckTareWeight","defaultId":"1","displayed":"1","required":"0"},{"fieldName":"originId","jsonPath":"$.originId","defaultId":"7","displayed":"1","required":"0"},{"fieldName":"specName","jsonPath":"$.specName","defaultId":"4","displayed":"1","required":"0"},{"fieldName":"truckType","jsonPath":"$.truckType","defaultId":"2","displayed":"1","required":"1","availableValueList":["10","20"]},{"fieldName":"imageCertList","jsonPath":"$.imageCertList[*]certType","defaultId":"11","displayed":"1","required":"0","availableValueList":["2","3"]},{"fieldName":"arrivalDatetime","jsonPath":"$.arrivalDatetime","defaultId":"9","displayed":"1","required":"0"},{"fieldName":"remark","jsonPath":"$.remark","defaultId":"8","displayed":"1","required":"0"},{"fieldName":"remark","jsonPath":"$.remark","defaultId":"6","displayed":"1","required":"0"},{"fieldName":"measureType","jsonPath":"$.measureType","defaultId":"12","displayed":"1","required":"1","availableValueList":["10","20"]}]}
    
    def __init__(self):
        self.url=fieldConfig.url.replace("http://test.",com.get_global_config("global_data", "environment", "en") )
        self.header=fieldConfig.header
        self.body=fieldConfig.body

       


# tt=fieldConfig()
# re=my.post(url=tt.url,headers=tt.header,json=tt.body)
# print(re.json())