Beispiel #1
0
def get_pdf_security(moduleName, parentGuid, name, check_log_guid,
                     module_name):
    url = environment.get_IP_PORT(
    ) + "safety/api/accessoryFile/getAccessoryFileId"
    headers = environment.get_headers()
    payload = {"moduleName": moduleName, "parentGuid": parentGuid}

    payload = json.dumps(payload)
    response = requests.request("POST", url, headers=headers, data=payload)
    data = response.text
    print(
        json.dumps(json.loads(data),
                   ensure_ascii=False,
                   sort_keys=True,
                   indent=4,
                   separators=(', ', ': ')))

    url = environment.get_IP_PORT(
    ) + "safety/api/accessoryFile/download/" + json.loads(data)["data"]
    headers = environment.get_headers()
    data = requests.get(url, headers=headers)
    pdf_path = PDF_FILE_PATH + os.sep + module_name + "_" + check_log_guid
    if not os.path.exists(pdf_path):
        os.makedirs(pdf_path)
    pdf_path += os.sep + name + ".pdf"
    with open(pdf_path, "wb") as code:
        code.write(data.content)
Beispiel #2
0
def exportPdf(module_name, guid, pdf_export, pdf_type):
    url = environment.get_IP_PORT(
    ) + "safety/api/" + module_name + "/" + pdf_export + "?guid=" + guid + "&type={}".format(
        pdf_type) if pdf_type is not None else ""
    headers = environment.get_headers()
    payload = json.dumps({})
    response = requests.request("POST", url, headers=headers, data=payload)
    return json.loads(response.content)
def list():
    url = environment.get_IP_PORT() + "safety/api/" + doc_type + "/list"
    headers = environment.get_headers()
    payload = {}
    payload = json.dumps(payload)
    response = requests.request("POST", url, headers=headers, data=payload)
    data = response.text
    # print(json.dumps(json.loads(data),ensure_ascii=False, sort_keys=True, indent=4, separators=(', ', ': ')))
    return json.loads(data)
def createDoc(guid, checkLogGuid=""):
    url = environment.get_IP_PORT() + "safety/api/" + doc_type + "/createDoc"
    headers = environment.get_headers()
    payload = {"guid": guid, "checkLogGuid": checkLogGuid}
    payload = json.dumps(payload)
    response = requests.request("POST", url, headers=headers, data=payload)
    data = response.text
    # print(json.dumps(json.loads(data),ensure_ascii=False, sort_keys=True, indent=4, separators=(', ', ': ')))
    return json.loads(data)
Beispiel #5
0
def pdfExport(guid):
    url = environment.get_IP_PORT()+"safety/api/"+doc_type+"/pdfExport"+"?guid="+guid+"&type={}".format(doc_type) if doc_type is not None else ""
    headers=environment.get_headers()
    payload = {"guid":guid}
    payload=json.dumps(payload)
    response = requests.request("POST", url, headers=headers, data = payload)
    data=response.text
    # print(json.dumps(json.loads(data),ensure_ascii=False, sort_keys=True, indent=4, separators=(', ', ': ')))
    return json.loads(data)
def request(guid):
    url = environment.get_IP_PORT(
    ) + "safety/api/securityCase/findNewCaseStepDetil?guid=" + guid
    headers = environment.get_headers()
    payload = {"guid": guid}
    payload = json.dumps(payload)
    response = requests.request("POST", url, headers=headers, data=payload)
    data = response.text
    # print(json.dumps(json.loads(data),ensure_ascii=False, sort_keys=True, indent=4, separators=(', ', ': ')))
    return json.loads(data)
import requests
import json
import sys

from zhak_projects.interface_request import environment

url = "http://localhost:9030/safety/api/suppliesWarehouse/statisticsBenchmark"
headers = environment.get_headers()
payload = "{\n\n    \"regionId\"    :210203000000\n\n          \n}"
response = requests.request("POST", url, headers=headers, data=payload)
data = response.text.encode('utf-8')
print("{}".format(json.loads(data)))
print(
    json.dumps(json.loads(data),
               sort_keys=True,
               indent=4,
               separators=(', ', ': ')))
def post(payload, url):
    headers = environment.get_headers()
    payload = json.dumps(payload)
    response = requests.request("POST", url, headers=headers, data=payload)
    return response.text
 def __init__(self, doc_type=""):
     self.base_url = environment.get_IP_PORT()
     self.headers = environment.get_headers()
     self.doc_type = doc_type
     self.fake = Faker('zh_CN')
Beispiel #10
0
def list(module_name):
    url = environment.get_IP_PORT() + "safety/api/" + module_name + "/list"
    headers = environment.get_headers()
    payload = json.dumps({"pageSize": pageSize})
    response = requests.request("POST", url, headers=headers, data=payload)
    return json.loads(response.content)