Add comments.
This commit is contained in:
parent
1cffde2903
commit
cd5d24b641
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user