Skip to content

Instantly share code, notes, and snippets.

Created March 23, 2012 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2167738 to your computer and use it in GitHub Desktop.
Save anonymous/2167738 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from BeautifulSoup import BeautifulSoup
import time
import urllib
import urllib2
def get_id(path):
html = urllib2.urlopen('http://dcurt.is/' + path).read()
soup = BeautifulSoup(html)
extid = soup.find("span", "extid").text
token = soup.find("meta", {'name': "csrf-token"})['content']
return dict(extid=extid, token=token)
def kudos(ident):
body = urllib.urlencode({'external_id': ident['extid']})
headers = {'Accept': '*/*', 'X-CSRF-Token': ident['token']}
req = urllib2.Request('http://dcurt.is/kudos', body, headers)
urllib2.urlopen(req)
ident = get_id('codename-svbtle')
while True:
kudos(ident)
print 'Kudos!'
time.sleep(0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment