Skip to content

Instantly share code, notes, and snippets.

@kenchangh
Created July 4, 2014 17:41
Show Gist options
  • Save kenchangh/e49fe516d41621f8edef to your computer and use it in GitHub Desktop.
Save kenchangh/e49fe516d41621f8edef to your computer and use it in GitHub Desktop.
A script that automates Prom King / Queen voting for SMK Damansara Jaya
import requests
import thread
def make_vote(gender):
if gender == 'f':
url = 'https://docs.google.com/forms/d/1RBXC6SrZ9D86qksVVlfybfNBi-zEG9npsIHWWNas8JM/formResponse'
form_data = {
'entry.1739159996': 'Karina Lee -5 Bal'
}
if gender == 'm':
url = 'https://docs.google.com/forms/d/1qejIamghWarT3p6axmpGJfC7MLfPgAa_6AJOiw-ZuCY/formResponse'
form_data = {
'entry.1199610921': 'Tey Tiong Oon - 5 Bal'
}
response = requests.post(url, data=form_data)
def loop_votes(gender, async=False, count=100):
counter = 0
for i in range(count):
if async:
try:
thread.start_new_thread(make_vote, (gender,))
except:
print 'Unable to start new thread'
else:
make_vote(gender)
counter += 1
print "Sent " + str(counter) + " request to " + gender
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment