Add status page #30
|
@ -69,7 +69,7 @@ def select_all_frames(conn):
|
|||
rows = cur.fetchall()
|
||||
return rows
|
||||
|
||||
def select_frames(conn, n, from_, url_params):
|
||||
def select_frames(conn, n, url_params):
|
||||
|
||||
# Should pass this a dict of fields and values (request.args)
|
||||
# TODO clean data before sending to DB
|
||||
|
@ -109,11 +109,10 @@ class Packets(Resource):
|
|||
n = int(request.args.get('n'))
|
||||
except:
|
||||
n = 10
|
||||
from_ = None if request.args.get('from') == None else request.args.get('from')
|
||||
|
||||
conn = get_db_connection()
|
||||
# Limit to number of records requested
|
||||
data = select_frames(conn, n = n, from_ = from_, url_params = request.args.to_dict())
|
||||
data = select_frames(conn, n = n, url_params = request.args.to_dict())
|
||||
# Sort by created date, descending (https://stackoverflow.com/a/45266808)
|
||||
#data.sort(key=operator.itemgetter('created'), reverse=True)
|
||||
return {'data':data}, 200 # return data and 200 OK code
|
||||
|
|
Loading…
Reference in New Issue
Block a user