aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorAlexander_Kabui2023-12-20 23:45:53 +0300
committerAlexander_Kabui2023-12-20 23:45:53 +0300
commit035b503f28ee32b91e7f6ab09e586571c536609e (patch)
treebf146d8fc4b48710e8bfd05019abec9605a4dbc7 /wqflask
parentdf6d66288758e90d5a7d226c9f5de2aeeb8c23f8 (diff)
downloadgenenetwork2-035b503f28ee32b91e7f6ab09e586571c536609e.tar.gz
code refactoring
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/views.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index ee4d6a59..e7249b28 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -262,22 +262,28 @@ def gsearchtable():
return flask.jsonify(current_page)
-
@app.route("/gnqna",methods =["POST","GET"])
def gnqna():
if request.method == "POST":
results = dict(request.form)
try:
- response = requests.post("http://localhost:5000/gnqa",json=results)
- if response.status_code ==200:
- return render_template("gnqa_answer.html",**response.json())
- return response.json()
- except Exception as e:
- return flask.jsonify({"error occurred":str(e)})
-
- #return render_template("gnqa_answer.html")
+ def __error__(resp):
+ return resp.json()
+ def __success__(resp):
+ return render_template("gnqa_answer.html",**resp.json())
+ return monad_requests.post(
+ urljoin("http://localhost:5000",
+ "/gnqa"),
+ json=results,
+ ).then(
+ lambda resp: resp
+ ).either(
+ __error__, __success__)
+ except Exception as error:
+ return flask.jsonify({"error":str(error)})
return render_template("gnqa.html")
+
@app.route("/gsearch_updating", methods=('POST',))
def gsearch_updating():
result = UpdateGSearch(request.args).__dict__