import sys
import datetime

sys.path.append('./')
sys.path.append('../')

from api.service.Service import Service
from api.access.AnalyticApiKey import AnalyticApiKey
from api.model.ResponseData import ResponseData

# replace with your own, otherwise nothing will be returned.
apikey = 'B63C4fZ0bQb6iu1EXYPMhsFLT_VqUhutPiu9fIwP'

if __name__ == '__main__':
    s = Service()
    s.debug(s.server_loc)
    k = AnalyticApiKey(apikey, s)
    s.debug('exists: ' + str(k.exists()))
    today = datetime.date.today()
    yesterday = today - datetime.timedelta(days = 1)
    r = ResponseData(k, **{'op': 'select',
                           'vn': 0,
                           'pv': 'rank',
                           'rb': yesterday.strftime('%Y-%m-%d'),
                           're': today.strftime('%Y-%m-%d')
                       })
    r.sync()
    s.debug('data object: ' + str(r.object))
    s.debug('=============')
    for k in r.object:
        s.debug("\n\tkey: %s\n\tvalue:%s\n-------\n" % (str(k), str(r.object[k])))
import sys
import datetime

sys.path.append('./')
sys.path.append('../')

from api.service.Service import Service
from api.access.AnalyticApiKey import AnalyticApiKey
from api.model.ResponseData import ResponseData

# replace with your own, otherwise nothing will be returned.
apikey = 'B63C4fZ0bQb6iu1EXYPMhsFLT_VqUhutPiu9fIwP'

if __name__ == '__main__':
    s = Service()
    s.debug(s.server_loc)
    k = AnalyticApiKey(apikey, s)
    s.debug('exists: ' + str(k.exists()))
    today = datetime.date.today()
    yesterday = today - datetime.timedelta(days=1)
    r = ResponseData(
        k, **{
            'op': 'select',
            'vn': 0,
            'pv': 'rank',
            'rb': yesterday.strftime('%Y-%m-%d'),
            're': today.strftime('%Y-%m-%d')
        })
    r.sync()
    s.debug('data object: ' + str(r.object))
    s.debug('=============')
Ejemplo n.º 3
0
def test2():
    s = Service()
    s.debug(s.server_loc)
    k = AnalyticApiKey(apikey, s)
    s.debug('exists: ' + str(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: ' + str(r.object))
    s.debug('=============')
    for k in r.object:
        s.debug("\n\tkey: %s\n\tvalue:%s\n-------\n" % (str(k), str(r.object[k])))
        if k == 'rows':
            for ro in r.object[k]:
                s.debug("\n\t\trow(%d): %s\n-------\n" % (len(ro), str(ro)))
Ejemplo n.º 4
0
def test1():
    s = Service()
    s.debug(s.server_loc)
    k = AnalyticApiKey(apikey, s)
    s.debug('exists: ' + str(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: ' + str(r.object))
    s.debug('=============')
    for k in r.object:
        s.debug("\n\tkey: %s\n\tvalue:%s\n-------\n" % (str(k), str(r.object[k])))
        if k == 'rows':
            for ro in r.object[k]:
                s.debug("\n\t\trow(%d): %s\n-------\n" % (len(ro), str(ro)))
Ejemplo n.º 5
0
def test1():
    s = Service()
    s.debug(s.server_loc)
    k = AnalyticApiKey('B63bQg1ipu37TmXLK4aH3gZgLWFmYJltMb2CBjCs', s)
    s.debug('exists: ' + str(k.exists()))
Ejemplo n.º 6
0
def test2():
    s = Service()
    s.debug(s.server_loc)
    k = AnalyticApiKey('xxx', s)
    k.exists()
    s.debug('exists: ' + str(k.exists()))