Skip to content

Commit

Permalink
Accept timestamp argument to send to stathat.
Browse files Browse the repository at this point in the history
  • Loading branch information
chronossc committed Aug 28, 2013
1 parent c34ede6 commit 6a66ff2
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions stathat.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@ def _http_post(self, path, data):
r = self.session.post(url, data=data)
return r

def value(self, key, value):
r = self._http_post('/ez', {'email': self.email, 'stat': key, 'value': value})
def value(self, key, value, timestamp=None):
data = {'email': self.email, 'stat': key, 'value': value}
if timestamp:
data['t'] = timestamp
r = self._http_post('/ez', data)
return r.ok

def count(self, key, count):
r = self._http_post('/ez', {'email': self.email, 'stat': key, 'count': count})
return r.ok
def count(self, key, count, timestamp=None):
data = {'email': self.email, 'stat': key, 'count': count}
if timestamp:
data['t'] = timestamp
r = self._http_post('/ez', data)
return r.ok

0 comments on commit 6a66ff2

Please sign in to comment.