1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| import json import re import requests from requests.auth import HTTPBasicAuth
userName="admin"
passWord="admin"
interfaceUrl="http://199.188.166.110:8080/MoiaControl/rest/RestService/nodeRedo"
taskNodesList=['a','b','c']
def request_post(url, param, user, pwd): try: headers = {'charset': 'utf-8'} result = requests.post(url, data=param, auth=HTTPBasicAuth(user,pwd)) text=result.content.decode() return text except Exception as e: print(e)
interpose={ "nodeType":1, "nodeName":"PLAN_003", "taskNode":"", "planDate":"", "orgName":"", "batchNum":"" } paramInfo={ "redoType":"1", "redoDate":"20220528", "runType":"", "pnode":"", "params":(), "interpose":"%s" % interpose }
resInfo = request_post(interfaceUrl, paramInfo, userName, passWord)
result=json.loads(resInfo)["done"] describe = json.loads(resInfo)["describe"]
if result: print("成功: %s" % (describe)) else: print("失败: %s" % (describe))
|