-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
28 lines (19 loc) · 879 Bytes
/
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
from flask import Flask, render_template
from flask import request
import requests
app = Flask(__name__, template_folder='.site', static_url_path='/.site')
@app.route('/')
def index():
return render_template("index.html")
@app.route('/submit', methods=['POST', 'GET'])
def submit_form():
oo = request.form['main']
url ='http://ip-api.com/json/'
y ='?fields=status,message,continent,continentCode,country,countryCode,region,regionName,city,district,zip,lat,lon,timezone,offset,currency,isp,org,as,asname,reverse,mobile,proxy,hosting,quey'
main = requests.post(url+oo+y)
data = main.json()
st = data['status']
return render_template('index.html', data=data, main=st, con=data['country'], res=data['regionName'], city=data['city'], lat=data['lat'], lon=data['lon'], isp=data['isp'])
#offset
if __name__ == '__main__':
app.run(debug=True)