定时任务#

管理定时任务模块

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

青龙面板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[源代码]#

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

参数
  • command – 命令

  • schedule – 定时时间

  • name – 定时任务名称

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

返回

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

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

task_run(id: list) int[源代码]#

根据id运行任务

参数

id – 任务ID列表

返回

响应码