blob: 4f6d17c755276cb8dfc1e28d500740bb410ff552 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
from flask import Flask, redirect, url_for, request, render_template,jsonify, session
import requests, json
import urllib, json
app = Flask(__name__)
app.secret_key = 'storperf_graphing_module'
#global url
@app.route('/reporting/success/')
def success():
header = {'x-requested-with': 'XMLHttpRequest'}
data = urllib.urlopen(session["url"]).read()
data = json.loads(data)
return render_template('plot_tables.html', data = data)
@app.route('/reporting/url',methods = ['POST', 'GET'])
def url():
if request.method == 'POST':
# global url
url = request.form['url']
session["url"] = url
return redirect(url_for('success'))
@app.route('/reporting/')
def index():
return render_template('index.html')
if __name__ == '__main__':
app.run(host="0.0.0.0", debug = True, threaded=True)
|