-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
61 lines (46 loc) · 1.29 KB
/
Copy pathapp.py
File metadata and controls
61 lines (46 loc) · 1.29 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from flask import Flask, jsonify, render_template, request, session, redirect
import requests
import webbrowser
import time
import json
import numpy as np
import pandas as pd
import VATSIMchecker_new
import math
import time
import os
from math import radians, cos, sin, asin, sqrt
global value
global g_dep_arr_tag
#http://127.0.0.1:4444/
app = Flask(__name__, static_url_path='')
def get_price(p_dep_arr_tag,airportcode):
global g_dep_arr_tag
global value
value = value + 1
if p_dep_arr_tag == ' ':
p_dep_arr_tag = 'D'
print(">" + p_dep_arr_tag + '/' + airportcode )
# convert into JSON:
data_json = VATSIMchecker_new.process_me(p_dep_arr_tag,airportcode)
#print(data_json[0])
return(data_json)
@app.route('/Airport/<ad_airportcode>')
def stuff(ad_airportcode):
ad_airportcode = ad_airportcode.upper()
#print(ad_airportcode[0:1])
#print(ad_airportcode[1:10])
price=get_price(ad_airportcode[0:1],ad_airportcode[1:10])
price = json.loads(price)
#print(price)
#for items in price: #["data"]:
# print(items["age"])
return jsonify(result=price)
#@app.route('/')
#def root():
# return app.send_static_file('airport1.html')
@app.route('/')
def index():
return render_template('airport1.html')
#main driver function
value = 0