-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
38 lines (35 loc) · 1.14 KB
/
app.py
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
29
30
31
32
33
34
35
36
37
38
import requests
import urllib
import json
import os
from flask import Flask,render_template,send_file,request,url_for,session,redirect
app = Flask(__name__)
@app.route('/')
def home():
return render_template('login.html')
@app.route('/search',methods = ['POST', 'GET'])
def search():
if (request.method == 'POST'):
a=[]
latitute =request.form["latitute"]
lat=23.259933
lon=77.412613
longitute =request.form["longitute"]
link="http://adityamandil317.pythonanywhere.com/query/{},{}".format(latitute,longitute)
f=urllib.request.urlopen(link).read().decode('UTF-8')
my=json.loads(f)
l=list(my)
#my=f.json()
#jsonResponse = json.loads(my.decode('utf-8'))
#y=json.loads(my)
#esponse = json.dumps(my.text, sort_keys = True, indent = 4, separators = (',', ': '))
#,latitute=latitute,longitute=longitute,length=length,breadth=breadth,width=width,height=height,bridge=bridge
return render_template('login.html',y=my)
return render_template('login.html')
@app.errorhandler(404)
def error(e):
return render_template('error.html')
@app.errorhandler(500)
def server():
return render_template('server-error.html')
app.run(host='0.0.0.0',debug=True)