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 | |
import cPickle as pickle | |
import random | |
# things I beat | |
tIB = {} | |
# things beat me | |
tBM = {} |
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
# send a new stat to a metric | |
import httplib | |
import urllib | |
params = urllib.urlencode({'metric_id': XXXXX, 'value': 1}) | |
# generated_at is set to now by default, to explicitly set use the following: | |
# params = urllib.urlencode({'metric_id': 4877, 'value': 1, 'generated_at':'2012-07-08 12:33:53'}) | |
headers = {'X-StatsMix-Token': 'STATSMIX_API_KEY'} | |
conn = httplib.HTTPConnection('api.statsmix.com:80') | |
conn.request('POST', '/api/v2/stats', params, headers) | |
response = conn.getresponse() |