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
| import json import re import requests from requests.auth import HTTPBasicAuth
userName="admin"
passWord="admin"
delPlanURL="http://199.188.166.110:8080/MoiaControl/rest/RestService/delPlan"
planList=['PLAN_B']
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)
for item in planList: planNames={"plans":"['%s']" % item} resInfo = request_post(delPlanURL, planNames, userName, passWord) print(resInfo) res = json.loads(resInfo)["done"] reason = json.loads(resInfo)["describe"] if res: print("成功: %s %s" % (item, reason)) else: print("失败: %s %s" % (item, reason))
|
蚂蚁🐜再小也是肉🥩!