Add comments.

This commit is contained in:
W1CDN 2023-04-16 19:29:09 -05:00
parent 1cffde2903
commit cd5d24b641

View File

@ -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)