From 2b481df94ce888bc547ddb93bfa7e97d953ebc51 Mon Sep 17 00:00:00 2001 From: Marek Baczynski Date: Sat, 10 Nov 2018 00:39:00 +0100 Subject: [PATCH] endpoint for getting a map for a given location ID /parts/getlocationURL/ --- parts/server.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/parts/server.py b/parts/server.py index 92710ee..32a14b2 100644 --- a/parts/server.py +++ b/parts/server.py @@ -57,6 +57,16 @@ def get_locations(): r.close() return json.dumps(l) +@app.route('/parts/getlocationURL/') +def get_locationURL(locationID): + s = 'select map from locations where id = :id;' + r = db_engine.execute(text(s), id=locationID) + l=[]; + for row in r: + l.append(row); + r.close() + return l[0][0] + @app.route('/parts/getpartinfo/') def get_part_info(partID): s = 'select * from parts as p inner join locations as l on p.location_id=l.id where p.id = :id;'