Created
November 20, 2018 15:06
-
-
Save leinonen/df0c0f3252a3fd0e4a1c93274bdddf24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request') | |
const host = '' | |
const interval = 100 | |
const president = 'That guy' | |
let voteCount = 0 | |
let errorCount = 0 | |
const handleResult = (err, res, body) => { | |
if (!err && res.statusCode === 200) { | |
console.log(`vote ${++voteCount}, errors: ${errorCount}`) | |
} else { | |
errorCount++; | |
} | |
} | |
const voteForPresident = () => { | |
request.post(host, { form: { vote: president } }, handleResult) | |
} | |
setInterval(voteForPresident, interval) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment