Created
March 23, 2012 06:40
-
-
Save anonymous/2167738 to your computer and use it in GitHub Desktop.
This file contains 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
#!/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