Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
eb10695873 | ||
|
a5978c2289 | ||
a1b9fc7ac4 |
11
api_app.py
11
api_app.py
|
@ -80,7 +80,7 @@ def select_frames(conn, n, url_params):
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
# Workaround to deal with missing value in WHERE
|
# Workaround to deal with missing value in WHERE
|
||||||
field_where_query = "" if field_where_str == "" else "WHERE "+field_where_str
|
field_where_query = "" if field_where_str == "" else "WHERE "+field_where_str
|
||||||
sql = 'SELECT * FROM frames {field_where_query} ORDER BY created DESC LIMIT {n}'.format(field_where_query=field_where_query, n=n)
|
sql = 'SELECT * FROM frames {field_where_query} ORDER BY id DESC LIMIT {n}'.format(field_where_query=field_where_query, n=n)
|
||||||
print(sql)
|
print(sql)
|
||||||
cur.execute(sql)
|
cur.execute(sql)
|
||||||
rows = cur.fetchall()
|
rows = cur.fetchall()
|
||||||
|
@ -102,6 +102,8 @@ def select_stations(conn, n):
|
||||||
@api_app.route('/')
|
@api_app.route('/')
|
||||||
def index():
|
def index():
|
||||||
|
|
||||||
|
path = config['Settings']['base_url']
|
||||||
|
|
||||||
# Get list of recent packets using API
|
# Get list of recent packets using API
|
||||||
# TODO use relative path
|
# TODO use relative path
|
||||||
#frames = json.loads(requests.get(url_for("packets", _external=True)).text)['data']
|
#frames = json.loads(requests.get(url_for("packets", _external=True)).text)['data']
|
||||||
|
@ -150,7 +152,8 @@ def index():
|
||||||
station_lon = config['Settings']['station_lon'],
|
station_lon = config['Settings']['station_lon'],
|
||||||
frames = frames,
|
frames = frames,
|
||||||
stations = stations,
|
stations = stations,
|
||||||
geojs = geojs)
|
geojs = geojs,
|
||||||
|
path = path)
|
||||||
|
|
||||||
@api_app.route('/map')
|
@api_app.route('/map')
|
||||||
def map():
|
def map():
|
||||||
|
@ -209,7 +212,7 @@ class Packets(Resource):
|
||||||
try:
|
try:
|
||||||
n = int(request.args.get('n'))
|
n = int(request.args.get('n'))
|
||||||
except:
|
except:
|
||||||
n = 10
|
n = 20
|
||||||
|
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
# Limit to number of records requested
|
# Limit to number of records requested
|
||||||
|
@ -224,7 +227,7 @@ class Stations(Resource):
|
||||||
try:
|
try:
|
||||||
n = int(request.args.get('n'))
|
n = int(request.args.get('n'))
|
||||||
except:
|
except:
|
||||||
n = 10
|
n = 20
|
||||||
|
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
# Limit to number of records requested
|
# Limit to number of records requested
|
||||||
|
|
|
@ -11,7 +11,7 @@ base_url = https://digi.w1cdn.net/aprs_api
|
||||||
keep_time = "2 days"
|
keep_time = "2 days"
|
||||||
|
|
||||||
# KISS settings
|
# KISS settings
|
||||||
kiss_host = 192.168.0.30
|
kiss_host = 192.168.0.100
|
||||||
kiss_port = 8001
|
kiss_port = 8001
|
||||||
|
|
||||||
# Development settings (not operational yet)
|
# Development settings (not operational yet)
|
||||||
|
|
|
@ -79,6 +79,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2> Recent RF Packets </h2>
|
<h2> Recent RF Packets </h2>
|
||||||
|
Query <a href="{{path}}/packets?n=10">10</a> | <a href="{{path}}/packets?n=50">50</a> | <a href="{{path}}/packets?n=100">100</a>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th> from </th>
|
<th> from </th>
|
||||||
|
@ -104,6 +105,7 @@
|
||||||
|
|
||||||
|
|
||||||
<h2> Recent Stations </h2>
|
<h2> Recent Stations </h2>
|
||||||
|
Query <a href="{{path}}/stations?n=10">10</a> | <a href="{{path}}/stations?n=50">50</a> | <a href="{{path}}/stations?n=100">100</a>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th> from </th>
|
<th> from </th>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user