massive-request/main.js

22 lines
615 B
JavaScript
Raw Normal View History

2023-06-20 05:41:33 +00:00
const axios = require('axios');
async function main() {
try {
const model = 'myModel';
const token = 'myToken';
const reqInterval = 500; // ms
const values = [
// Put here your values
];
for (let value of values) {
let url = `https://salix.verdnatura.es/api/${model}/${value}/download?access_token=${token}`;
await axios.get(url);
console.log(`Processed: ${value}`);
await new Promise(resolve => setTimeout(resolve, reqInterval));
}
console.log(`It has been processed successfully!`);
} catch (err) {
console.error('Error: ', err.response.data);
}
}
main();