Skip to content

Instantly share code, notes, and snippets.

@leinonen
Created November 20, 2018 15:06
Show Gist options
  • Save leinonen/df0c0f3252a3fd0e4a1c93274bdddf24 to your computer and use it in GitHub Desktop.
Save leinonen/df0c0f3252a3fd0e4a1c93274bdddf24 to your computer and use it in GitHub Desktop.
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