定时任务#

管理定时任务模块

class qlapi.qltask(url: str, post: int, client_id: str, client_secret: str)[source]#

青龙面板api定时任务模块

url: 青龙面板IP地址(不包含http://)

post: 青龙面板端口

client_id: 青龙面板openapi登录用户名

client_secret: 青龙面板openapi登录密码

Usage::
>>> ql_task = qltask(
    url="12.22.43.23",
    port=5700,
    client_id="admin",
    client_secret="abcdefg_",
)
ql_task.list()
add(command: str, schedule: str, name: str, labels: str = '') dict[source]#

添加定时任务,返回相应状态码以及响应结果或任务ID

Parameters
  • command – 命令

  • schedule – 定时时间

  • name – 定时任务名称

  • labels – 备注,测试不通过,留空

Returns

成功返回示例 {‘code’: 200, ‘data’: 47}

失败返回示例 {‘code’: 500, ‘data’: ‘Validation error’}

task_run(id: list) int[source]#

根据id运行任务

Parameters

id – 任务ID列表

Returns

响应码