Beispiel #1
0
def create_statistics():
    stats = []
    devices = ['cucumber', 'pumpkin', 'tomato', 'avocado', 'toast']
    for i in range(len(devices)):
        for date in ['20170101', '20170102', '20170103', '20170104', '20170105']:
            for version in ['13.0', '14.1']:
                for t in ['NIGHTLY', 'UNOFFICIAL']:
                        Statistic(d=str(i), m=devices[i], v='{}-{}-{}-{}'.format(version, date, t, devices[i]), u='US', c='Carrier', c_id='0').save()
                        Aggregate.add_stat(d=str(i), m=devices[i], v='{}-{}-{}-{}'.format(version, date, t, devices[i]), u='US', c='Carrier', c_id='0')
Beispiel #2
0
 def on_post(self, req, resp):
     '''Handles post requests to /api/v1/stats'''
     data = req.media
     Aggregate.add_stat(d=data['device_hash'],
                        m=data['device_name'],
                        v=data['device_version'],
                        u=data['device_country'],
                        c=data['device_carrier'],
                        c_id=data['device_carrier_id'])
     resp.body = "neat"
     resp.content_type = "text/plain"