From cd5d24b6418cbf8ab7bc4cd0c3a962db75fbd792 Mon Sep 17 00:00:00 2001 From: W1CDN Date: Sun, 16 Apr 2023 19:29:09 -0500 Subject: [PATCH] Add comments. --- api_app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api_app.py b/api_app.py index 6ceebf1..00d0a9e 100644 --- a/api_app.py +++ b/api_app.py @@ -67,12 +67,14 @@ def select_all_frames(conn): class Packets(Resource): def get(self): + # Handle arguments that may or may not exist try: n = int(request.args.get('n')) except: n = 10 - print(n) + conn = get_db_connection() + # Limit to number of records requested data = select_all_frames(conn)[-n:] # Sort by created date, descending (https://stackoverflow.com/a/45266808) data.sort(key=operator.itemgetter('created'), reverse=True)