def rescuetime(self, params): """docstring for rescuetime""" s = Service() s.debug(s.server_loc) k = AnalyticApiKey('B63mNzrDeMVC_tMEIo5gBxGyf0eYonYTTRFcfR8s', s) r = ResponseData(k, **params) try: r.sync() json = r.object except: json = None return json
def test1(): s = Service('http://localhost:3000') s.debug(s.server_loc) k = AnalyticApiKey('B63C4fZ0bQb6iu1EXYPMhsFLT_VqUhutPiu9fIwP', s) s.debug('exists: ' + unicode(k.exists())) r = ResponseData(k, {'op': 'select', 'vn': 0, 'pv': 'rank', 'rb': (datetime.date.today() - datetime.timedelta(weeks = 1)).strftime('%Y-%m-%d'), 're': datetime.date.today().strftime('%Y-%m-%d'), 'rk': 'overview' }) r.sync() s.debug('data object: ' + unicode(r.object)) s.debug('=============') for k in r.object: s.debug("\n\tkey: %s\n\tvalue:%s\n-------\n" % (unicode(k), unicode(r.object[k]))) if k == 'rows': for ro in r.object[k]: s.debug("\n\t\trow(%d): %s\n-------\n" % (len(ro), unicode(ro)))
def test2(): s = Service('http://localhost:3000') s.debug(s.server_loc) k = AnalyticApiKey('B63C4fZ0bQb6iu1EXYPMhsFLT_VqUhutPiu9fIwP', s) s.debug('exists: ' + unicode(k.exists())) r = ResponseData(k) today = datetime.date.today() r.params(operation = 'select').params(perspective = 'rank') r.params(version = 0, restrict_begin = (today - datetime.timedelta(weeks = 1)).strftime('%Y-%m-%d'), restrict_end = today.strftime('%Y-%m-%d'), restrict_kind = 'overview') r.sync() s.debug('data object: ' + unicode(r.object)) s.debug('=============') for k in r.object: s.debug("\n\tkey: %s\n\tvalue:%s\n-------\n" % (unicode(k), unicode(r.object[k]))) if k == 'rows': for ro in r.object[k]: s.debug("\n\t\trow(%d): %s\n-------\n" % (len(ro), unicode(ro)))
def test2(): s = Service('http://localhost:3000') s.debug(s.server_loc) k = AnalyticApiKey('B63C4fZ0bQb6iu1EXYPMhsFLT_VqUhutPiu9fIwP', s) s.debug('exists: ' + unicode(k.exists())) r = ResponseData(k) today = datetime.date.today() r.params(operation='select').params(perspective='rank') r.params(version=0, restrict_begin=(today - datetime.timedelta(weeks=1)).strftime('%Y-%m-%d'), restrict_end=today.strftime('%Y-%m-%d'), restrict_kind='overview') r.sync() s.debug('data object: ' + unicode(r.object)) s.debug('=============') for k in r.object: s.debug("\n\tkey: %s\n\tvalue:%s\n-------\n" % (unicode(k), unicode(r.object[k]))) if k == 'rows': for ro in r.object[k]: s.debug("\n\t\trow(%d): %s\n-------\n" % (len(ro), unicode(ro)))
def test1(): s = Service('http://localhost:3000') s.debug(s.server_loc) k = AnalyticApiKey('B63C4fZ0bQb6iu1EXYPMhsFLT_VqUhutPiu9fIwP', s) s.debug('exists: ' + unicode(k.exists())) r = ResponseData( k, { 'op': 'select', 'vn': 0, 'pv': 'rank', 'rb': (datetime.date.today() - datetime.timedelta(weeks=1)).strftime('%Y-%m-%d'), 're': datetime.date.today().strftime('%Y-%m-%d'), 'rk': 'overview' }) r.sync() s.debug('data object: ' + unicode(r.object)) s.debug('=============') for k in r.object: s.debug("\n\tkey: %s\n\tvalue:%s\n-------\n" % (unicode(k), unicode(r.object[k]))) if k == 'rows': for ro in r.object[k]: s.debug("\n\t\trow(%d): %s\n-------\n" % (len(ro), unicode(ro)))
def test2(self): s = Service(url) s.debug(s.server_loc) k = AnalyticApiKey(key, s) s.debug('exists: ' + unicode(k.exists())) r = ResponseData(k) today = datetime.date.today() r.params(operation = 'select').params(perspective = 'interval') r.params(version = 0, restrict_begin = (today - datetime.timedelta(weeks = 1)).strftime('%Y-%m-%d'), restrict_end = today.strftime('%Y-%m-%d'), restrict_kind = 'productivity') r.params(resolution_time='hour') r.sync() s.debug('data object: ' + unicode(r.object)) s.debug('=============') for k in r.object: s.debug("\n\tkey: %s\n\tvalue:%s\n-------\n" % (unicode(k), unicode(r.object[k]))) if k == 'rows': for ro in r.object[k]: s.debug("\n\t\trow(%d): %s\n-------\n" % (len(ro), unicode(ro)))
def teddst1(self): s = Service(url) s.debug(s.server_loc) k = AnalyticApiKey(key, s) s.debug('exists: ' + unicode(k.exists())) r = ResponseData( k, { 'op': 'select', 'vn': 0, 'pv': 'rank', 'rb': (datetime.date.today() - datetime.timedelta(weeks=1)).strftime('%Y-%m-%d'), 're': datetime.date.today().strftime('%Y-%m-%d'), 'rk': 'overview' }) r.sync() s.debug('data object: ' + unicode(r.object)) s.debug('=============') for k in r.object: s.debug("\n\tkey: %s\n\tvalue:%s\n-------\n" % (unicode(k), unicode(r.object[k]))) if k == 'rows': for ro in r.object[k]: s.debug("\n\t\trow(%d): %s\n-------\n" % (len(ro), unicode(ro)))
def test2(self): s = Service(url) s.debug(s.server_loc) k = AnalyticApiKey(key, s) k.exists() s.debug('exists: ' + unicode(k.exists()))
def __init__(self, key): self.service = Service(url) self.key = AnalyticApiKey(key, self.service) self.r = ResponseData(self.key)
def test1(): s = Service('http://localhost:3000') s.debug(s.server_loc) k = AnalyticApiKey('B63bQg1ipu37TmXLK4aH3gZgLWFmYJltMb2CBjCs', s) s.debug('exists: ' + unicode(k.exists()))
def test2(): s = Service('http://localhost:3000') s.debug(s.server_loc) k = AnalyticApiKey('xxx', s) k.exists() s.debug('exists: ' + unicode(k.exists()))
def data(self, params=None): a = AnalyticApiKey(self.rescuetime_key, "ProcrasDonate") s = Service() params = params or {} return s.fetch_data(a, params)
def test2(self): s = Service(url) s.debug(s.server_loc) k = AnalyticApiKey(key, s) s.debug('exists: ' + unicode(k.exists())) r = ResponseData(k) today = datetime.date.today() r.params(operation='select').params(perspective='interval') r.params( version=0, restrict_begin=(today - datetime.timedelta(weeks=1)).strftime('%Y-%m-%d'), restrict_end=today.strftime('%Y-%m-%d'), restrict_kind='productivity') r.params(resolution_time='hour') r.sync() s.debug('data object: ' + unicode(r.object)) s.debug('=============') for k in r.object: s.debug("\n\tkey: %s\n\tvalue:%s\n-------\n" % (unicode(k), unicode(r.object[k]))) if k == 'rows': for ro in r.object[k]: s.debug("\n\t\trow(%d): %s\n-------\n" % (len(ro), unicode(ro)))
def test2(): s = Service("http://localhost:3000") s.debug(s.server_loc) k = AnalyticApiKey("xxx", s) k.exists() s.debug("exists: " + unicode(k.exists()))
def test1(): s = Service("http://localhost:3000") s.debug(s.server_loc) k = AnalyticApiKey("B63bQg1ipu37TmXLK4aH3gZgLWFmYJltMb2CBjCs", s) s.debug("exists: " + unicode(k.exists()))
def teddst1(self): s = Service(url) s.debug(s.server_loc) k = AnalyticApiKey(key, s) s.debug('exists: ' + unicode(k.exists())) r = ResponseData(k, {'op': 'select', 'vn': 0, 'pv': 'rank', 'rb': (datetime.date.today() - datetime.timedelta(weeks = 1)).strftime('%Y-%m-%d'), 're': datetime.date.today().strftime('%Y-%m-%d'), 'rk': 'overview' }) r.sync() s.debug('data object: ' + unicode(r.object)) s.debug('=============') for k in r.object: s.debug("\n\tkey: %s\n\tvalue:%s\n-------\n" % (unicode(k), unicode(r.object[k]))) if k == 'rows': for ro in r.object[k]: s.debug("\n\t\trow(%d): %s\n-------\n" % (len(ro), unicode(ro)))