iok's notebooks

  • Untitled - /iok/test123
    Last edited 6 years ago
    require("request") const request = require("request-promise") var options = { uri: 'https://s3-us-west-2.amazonaws.com/alexa-skill-oncall/oncall.json', headers: { 'User-Agent': 'Request-Promise' }, json: true // Automatically parses the JSON string in the response }; request(options) .then(function (repos) { var isFirst = true; for (var property in repos) { if (repos.hasOwnProperty(property)) { if (isFirst){ console.log("On-call for "+property+" is " + repos[property]+"."); isFirst = false; } else { console.log("For "+property+" is " + repos[property]); } } } }) .catch(function (err) { console.log(err); // API call failed... }); function normalize(teamNameSlot){ switch (teamNameSlot) { case teamNameSlot.includes("engagement"): return "ava-engagement"; break; case teamNameSlot.includes("skills"): return "ava-skills"; break; default: return "ava"; } }
  • Untitled - /iok/test
    Last edited 7 years ago
    require("request") const request = require("request-promise") var options = { uri: 'https://ya.ru', headers: { 'User-Agent': 'Request-Promise' }, json: true // Automatically parses the JSON string in the response }; request(options) .then(function (repos) { console.log(repos); }) .catch(function (err) { console.log(err); // API call failed... }); exports.endpoint = function(request, response) { response.end("Hello world!"); }