Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions python/stathat.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import urllib
import urllib2
from urllib.parse import urlencode
from urllib.request import Request, urlopen

class StatHat:

def http_post(self, path, data):
pdata = urllib.urlencode(data)
req = urllib2.Request('http://api.stathat.com' + path, pdata)
resp = urllib2.urlopen(req)
pdata = urlencode(data)
pdata = pdata.encode('ascii')
req = Request('http://api.stathat.com' + path, pdata)
resp = urlopen(req)
return resp.read()

def post_value(self, user_key, stat_key, value, timestamp=None):
Expand Down