Skip to content

Instantly share code, notes, and snippets.

@pcote
Created March 17, 2017 16:10
Show Gist options
  • Save pcote/0eaa75e883dfd01f7beb0e2703fff18c to your computer and use it in GitHub Desktop.
Save pcote/0eaa75e883dfd01f7beb0e2703fff18c to your computer and use it in GitHub Desktop.
@app.route("/filenames", methods=["GET"])
def get_filenames():
filenames = os.listdir("uploads/")
modify_time_sort = lambda f: os.stat("uploads/{}".format(f)).st_atime
filenames = sorted(filenames, key=modify_time_sort)
return_dict = dict(filenames=filenames)
return jsonify(return_dict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment