Commit c2bd786d authored by ale's avatar ale

do not return lists from handlers

parent 497dc45a
......@@ -26,26 +26,25 @@ def before_request():
@app.route('/submit', methods=('GET', 'POST'))
def receive():
if request.method == 'GET':
return ['ok']
p = g.redis.pipeline(transaction=False)
#per_user = {}
for user, results in request.json.iteritems():
key = 'virus:%s' % user
#p.ltrim(key, 0, 0)
for r in results:
p.lpush(key, r)
#per_user[user] = len(results)
# Save some incremental stats with per-user infection counts.
#new_ptr = 'virus_stats:%f' % time.time()
#for user, count in per_user.iteritems():
# p.hset(new_ptr, user, count)
#p.set('virus_stats:head', new_ptr)
p.execute()
return ['ok']
if request.method == 'POST':
p = g.redis.pipeline(transaction=False)
#per_user = {}
for user, results in request.json.iteritems():
key = 'virus:%s' % user
#p.ltrim(key, 0, 0)
for r in results:
p.lpush(key, r)
#per_user[user] = len(results)
# Save some incremental stats with per-user infection counts.
#new_ptr = 'virus_stats:%f' % time.time()
#for user, count in per_user.iteritems():
# p.hset(new_ptr, user, count)
#p.set('virus_stats:head', new_ptr)
p.execute()
return 'ok'
def create_app():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment