青龙面板挨个执行所有任务(有等待时间)

Authorization的值要自己通过浏览器 f12抓取青龙面部的认证头,暂时不知道如何自动获取,有知道的可以告知下,我对青龙一窍不通.
python的代码如下

import requests
import json
import time

url = "http://192.168.88.129:5700/api/crons?page=1&size=500&filters={}&t=1665038371774"

payload={}
headers = {
'Accept': '/',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'Authorization': 'Bearer eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJkYXRhIjoiSHROUGZjLW5MbUNMVlZTVFlVUW9ReW5CMnJEMHdxaEk2R3NSZzZrTTdoanlCWU9ROXhWWEpfIiwiaWF0IjoxNjY0MzY5Mjk4LCJleHAiOjE2NjYwOTcyOTh9.QO8PzXBtZvz89pQhNF0eMdjAqJOF45UACtMTDBjVYcMAFJBD0ouhXjksTC7RxNcD',
'Connection': 'keep-alive',
'Referer': 'http://192.168.88.129:5700/crontab',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.34'
}

response = requests.request("GET", url, headers=headers, data=payload)

text = json.loads(response.text)

print(text)

for cursor in text['data']['data']:
print( cursor['id'])
url = "http://192.168.88.129:5700/api/crons/run?t=1665026130128"

payload = "["+str(cursor['id'])+"]"

headers = {
'Accept': 'application/json',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'Authorization': 'Bearer eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJkYXRhIjoiSHROUGZjLW5MbUNMVlZTVFlVUW9ReW5CMnJEMHdxaEk2R3NSZzZrTTdoanlCWU9ROXhWWEpfIiwiaWF0IjoxNjY0MzY5Mjk4LCJleHAiOjE2NjYwOTcyOTh9.QO8PzXBtZvz89pQhNF0eMdjAqJOF45UACtMTDBjVYcMAFJBD0ouhXjksTC7RxNcD',
'Connection': 'keep-alive',
'Content-Type': 'application/json;charset=UTF-8',
'Origin': 'http://192.168.88.129:5700',
'Referer': 'http://192.168.88.129:5700/crontab',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.34'
}


response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
time.sleep(15)

java代码如下

public static void  loop(){
    OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
    Request request = new Request.Builder()
            .url("http://192.168.88.129:5700/api/crons?page=1&size=500&filters={}&t=1665038371774")
            .method("GET", null)
            .addHeader("Accept", "*/*")
            .addHeader("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6")
            .addHeader("Authorization", "Bearer eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJkYXRhIjoiSHROUGZjLW5MbUNMVlZTVFlVUW9ReW5CMnJEMHdxaEk2R3NSZzZrTTdoanlCWU9ROXhWWEpfIiwiaWF0IjoxNjY0MzY5Mjk4LCJleHAiOjE2NjYwOTcyOTh9.QO8PzXBtZvz89pQhNF0eMdjAqJOF45UACtMTDBjVYcMAFJBD0ouhXjksTC7RxNcD")
            .addHeader("Connection", "keep-alive")
            .addHeader("Referer", "http://192.168.88.129:5700/crontab")
            .addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.34")
            .build();
    try {
        Response response = client.newCall(request).execute();
        String json = response.body().string();

        JSONObject jsonObject = JSON.parseObject(json);
        JSONArray jsonArray  = jsonObject.getJSONObject("data").getJSONArray("data");
        for(int i=0;i

你可能感兴趣的:(青龙面板挨个执行所有任务(有等待时间))