Ejemplo n.º 1
0
def store_data(data):
    data['timestamp'] = timestamp = utcnow()
    helpers.save_stats(exts.databases.librarian, {
        'time': timestamp,
        'payload': StatBitStream.to_bytes([data])
    })
    logging.debug("Data stored for user_id: %s", data['user_id'])
Ejemplo n.º 2
0
 def get(self):
     device_id_file = self.config['analytics.device_id_file']
     db = exts.databases.librarian
     _, payload = get_payload(db, device_id_file, limit=None)
     filename = '{}.stats'.format(utcnow().isoformat())
     return send_file(StringIO(payload), filename, attachment=True)