1
This repository has been archived on 2021-11-25. You can view files and clone it, but cannot push or open issues or pull requests.
Project_Steam_Tracker/poc.py
2021-01-11 16:23:00 +01:00

30 lines
815 B
Python

import json
from flask import Flask, render_template, request
app = Flask(__name__)
with open('steam.json') as file:
blob = json.load(file)
@app.route('/')
def root():
items = []
if request.args.get('sortby') == "name":
sortedblob = sorted(blob, key=lambda k: k['name'])
elif request.args.get('sortby') == "release_date":
sortedblob = sorted(blob, key=lambda k: k['release_date'])
elif request.args.get('sortby') == "price":
sortedblob = sorted(blob, key=lambda k: k['price'])
else:
sortedblob = blob # hoezo memory efficient werken?
for x in range(0,99):
items.append(sortedblob[x])
return render_template('poc.html', gfgn=blob[0], len=len(blob), items=items)
if __name__ == "__main__":
app.run('0.0.0.0', port=5001, debug=True)