From 5e0f19883675f0c4a1343e8f89876e78e6bc0df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 11 Apr 2018 16:16:19 +0200 Subject: [PATCH] fix: Search field --- website/web/__init__.py | 10 +++++++--- website/web/templates/index.html | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/website/web/__init__.py b/website/web/__init__.py index 9fe6e88..5f4bfe2 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- -from flask import Flask, render_template +from flask import Flask, render_template, request from flask_bootstrap import Bootstrap from bgpranking.querying import Querying @@ -22,8 +22,12 @@ def index(): return render_template('index.html', ranks=ranks) -@app.route('/asn/', methods=['GET']) -def asn_details(asn): +@app.route('/asn', methods=['GET', 'POST']) +def asn_details(): q = Querying() + if request.method == 'POST': + asn = request.form['asn'] + if request.method == 'GET': + asn = request.args['asn'] ranks = q.asn_details(asn) return render_template('asn.html', asn=asn, ranks=ranks) diff --git a/website/web/templates/index.html b/website/web/templates/index.html index 0dc9f05..b446362 100644 --- a/website/web/templates/index.html +++ b/website/web/templates/index.html @@ -6,7 +6,7 @@

BGP Ranking



-
+ ASN to search: