πŸŒ‚Get task statistics

In this Example, we getting information about task by TASKID.

Python

import requests

headers = {
    'Authorization': 'YOUR_API_KEY' ## your api key (string)
}
params = {
    'taskid': '123' ## taskid
}
r = requests.get('https://saturn.alterra.lol/api/stats/', params=data, headers=headers)
if r.status_code == 200:
    data = r.json()
    print(f'SteamID64: {data['steamid64']}, status: {data['status']}, SUCCESS: {data['SUCCESS']}, KT: {data['KT']}, ERRORS: {data['ERRORS']}')
else:
    print(f"seems like request failed: {r.status_code}. Response from server: {r.content}")

Node.js

const axios = require("axios");

const headers = {
  Authorization: "YOUR_API_KEY", // your api key (string)
};

const params = {
  taskid: "123", // taskid
};

axios
  .get("https://saturn.alterra.lol/api/stats/", { headers, params })
  .then((response) => {
    if (response.status === 200) {
      try {
        const data = response.data;
        console.log(
          `SteamID64: ${data.steamid64}, status: ${data.status}, SUCCESS: ${data.SUCCESS}, KT: ${data.KT}, ERRORS: ${data.ERRORS}`
        );
      } catch (e) {
        console.log("error:", e);
      }
    } else {
      console.log(
        `seems like request failed: ${response.status}. resp from server: `,
        response.data
      );
    }
  })
  .catch((error) => {
    if (error.response) {
      console.log(
        `request failed with status ${error.response.status}. response:`,
        error.response.data
      );
    } else {
      console.log("error in making req:", error.message);
    }
  });

Last updated