From 44f1bcac334f1b120797695e4f3cad0afd0c6742 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Fri, 28 Jun 2024 15:04:29 -0400 Subject: [PATCH] Add API endpoints for just 3 or just 6 words --- app.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index a1b5579..7df2740 100755 --- a/app.py +++ b/app.py @@ -52,8 +52,6 @@ def showMapFromLatLng(lat, lng): # API @get('/api/,') def latLngToHash(lat, lng): - print(lat, file=sys.stdout) - print(lng, file=sys.stdout) try: three = these.three_words((lat,lng,)) six = these.six_words((lat,lng,)) @@ -62,6 +60,24 @@ def latLngToHash(lat, lng): print(error, file=sys.stderr) return {} +@get('/api/three/,') +def latLngToThreeHash(lat, lng): + try: + three = these.three_words((lat,lng,)) + return {'three': three} + except Exception as error: + print(error, file=sys.stderr) + return {} + +@get('/api/six/,') +def latLngToSixHash(lat, lng): + try: + six = these.six_words((lat,lng,)) + return {'six': six} + except Exception as error: + print(error, file=sys.stderr) + return {} + @get('/api/') def hashToLatLng(threewords):