commit 77b1b251c975b89f4f34faa9c0684d43c6600643 Author: coulisse Date: Wed Jan 22 15:18:38 2020 +0000 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..e81a030 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# spiderweb diff --git a/templates/results.html b/templates/results.html new file mode 100644 index 0000000..f71fbb2 --- /dev/null +++ b/templates/results.html @@ -0,0 +1,77 @@ + + + + + + + + + + + +
+ +
+
+ + + + diff --git a/webapp.py b/webapp.py new file mode 100644 index 0000000..fee27f0 --- /dev/null +++ b/webapp.py @@ -0,0 +1,36 @@ +import flask +from flask import request, render_template +import MySQLdb as my +import json +app = flask.Flask(__name__) +app.config["DEBUG"] = True + +# A route to return all of the available entries in our catalog. +@app.route('/', methods=['GET']) +def spots(): + + db = my.connect(host='localhost', + user='webdb', + passwd='Zw73dp', + db='dxcluster' + ) + + cursor = db.cursor() + number_of_rows = cursor.execute('''SET NAMES 'utf8';''') + number_of_rows = cursor.execute('''SELECT rowid, spotter, freq, spotcall, comment, time from dxcluster.spot ORDER BY rowid desc limit 100;''') + row_headers=[x[0] for x in cursor.description] #this will extract row headers + rv=cursor.fetchall() + payload=[] + for result in rv: + payload.append(dict(zip(row_headers,result))) + + db.close() + #print payload + return render_template( + 'results.html', + # response=json.dumps(payload) + payload=payload + ) + +app.run(host='0.0.0.0',port=8080) +