Пример #1
0
    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)))
Пример #2
0
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)))
Пример #3
0
 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)))
Пример #4
0
 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)))
Пример #5
0
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)))
Пример #6
0
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)))
Пример #7
0
    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)))
Пример #8
0
    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
Пример #9
0
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)))
Пример #10
0
def test1():
    s = Service("http://localhost:3000")
    s.debug(s.server_loc)
    k = AnalyticApiKey("B63bQg1ipu37TmXLK4aH3gZgLWFmYJltMb2CBjCs", s)
    s.debug("exists: " + unicode(k.exists()))
Пример #11
0
def test2():
    s = Service("http://localhost:3000")
    s.debug(s.server_loc)
    k = AnalyticApiKey("xxx", s)
    k.exists()
    s.debug("exists: " + unicode(k.exists()))
Пример #12
0
 def data(self, params=None):
     a = AnalyticApiKey(self.rescuetime_key, "ProcrasDonate")
     s = Service()
 
     params = params or {}
     return s.fetch_data(a, params)
Пример #13
0
def test2():
    s = Service('http://localhost:3000')
    s.debug(s.server_loc)
    k = AnalyticApiKey('xxx', s)
    k.exists()
    s.debug('exists: ' + unicode(k.exists()))
Пример #14
0
 def test2(self):
     s = Service(url)
     s.debug(s.server_loc)
     k = AnalyticApiKey(key, s)
     k.exists()
     s.debug('exists: ' + unicode(k.exists()))
Пример #15
0
 def __init__(self, key):
     self.service = Service(url)
     self.key = AnalyticApiKey(key, self.service)
     self.r = ResponseData(self.key)
Пример #16
0
 def test2(self):
     s = Service(url)
     s.debug(s.server_loc)
     k = AnalyticApiKey(key, s)
     k.exists()
     s.debug('exists: ' + unicode(k.exists()))
Пример #17
0
def test1():
    s = Service('http://localhost:3000')
    s.debug(s.server_loc)
    k = AnalyticApiKey('B63bQg1ipu37TmXLK4aH3gZgLWFmYJltMb2CBjCs', s)
    s.debug('exists: ' + unicode(k.exists()))