-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.py
72 lines (52 loc) · 2.42 KB
/
common.py
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
from request_sender import sendRequest
"""
面板通用设置
本项目使用Apache License 2.0开原协议。您在修改、分发本项目中的任意一个文件时,必须阅读、同意并遵守该协议。
This project uses the Apache License 2.0 open source agreement. You must read, agree to, and abide by this agreement when modifying or distributing any of the files in this project.
白墨麒麟Hot / 白墨麒麟 / BaimoQilin / Zhou-Shilin / 周示麟
"""
def get_overview(url, apikey):
# 数据监控
# 返回类型:json
# 返回内容解释:详见https://docs.mcsmanager.com/#/zh-cn/apis/panel/overview
api_url = url + "/api/overview"
response = sendRequest(api_url, apikey)
return response
def get_remote_services_system_overview(url, apikey):
# 查看面板数据简报
# 返回类型:json
# 返回内容解释:详见https://docs.mcsmanager.com/#/zh-cn/apis/remote/get_remote_services_info
api_url = url + "/api/service/remote_services_system"
response = sendRequest(api_url, apikey)
return response
def get_settings(url, apikey):
# 获取面板设置
# 返回类型:json
# 返回内容解释:详见https://docs.mcsmanager.com/#/zh-cn/apis/panel/get_settings
api_url = url + "/api/overview/setting"
response = sendRequest(api_url, apikey)
return response
def edit_settings(url, apikey, httpPort="25566", httpIP=None, dataPort=23334, forwardType=1, crossDomain=False, gzip=False, maxCompress=1, maxDonwload=10, zipType=1, loginCheckIp=True, loginInfo="", canFileManager=True, language="en_us", quickInstallAddr="https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/quick_install.json", redisUrl=""):
# 修改面板设置
# 返回类型:bool
# 返回内容解释:True(成功)
api_url = url + "/api/overview/setting"
_body = {
'httpPort': httpPort,
'httpIp': httpIP,
'dataPort': dataPort,
'forwardType': forwardType,
'crossDomain': crossDomain,
'gzip': gzip,
'maxCompress': maxCompress,
'maxDonwload': maxDonwload,
'zipType': zipType,
'loginCheckIp': loginCheckIp,
'loginInfo': loginInfo,
'canFileManager': canFileManager,
'language': language,
'quickInstallAddr': quickInstallAddr,
'redisUrl': redisUrl
}
response = sendRequest(api_url, None, None, apikey, method="put",body=_body)
return True