simpler
This commit is contained in:
14
testAPI.js
14
testAPI.js
@@ -1,16 +1,18 @@
|
||||
const request = require('request');
|
||||
|
||||
var till = 15;
|
||||
var till = 5;
|
||||
var completed = 0;
|
||||
var errors = 0;
|
||||
|
||||
for(let i=0; i<till; i++){
|
||||
console.log('calling', i);
|
||||
let httpOptions = {
|
||||
url: 'http://codeland.bytedev.co:2000/api/run',
|
||||
url: 'http://codeland.bytedev.co:2000/api/run?once=true',
|
||||
form: {
|
||||
code: `python3 -c "print(1)"`,
|
||||
once: true,
|
||||
code: `python3 -c "
|
||||
from time import sleep
|
||||
sleep(10)
|
||||
"`,
|
||||
}
|
||||
};
|
||||
request.post(httpOptions, function(error, response, body){
|
||||
@@ -20,8 +22,8 @@ for(let i=0; i<till; i++){
|
||||
}
|
||||
|
||||
body = JSON.parse(body);
|
||||
|
||||
console.log(i, body);
|
||||
let res = (Buffer.from(body.res, 'base64').toString('ascii'));
|
||||
console.log(i, res);
|
||||
if(completed===till){
|
||||
console.log(errors);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user