Add API endpoints for just 3 or just 6 words
This commit is contained in:
parent
d388791009
commit
44f1bcac33
20
app.py
20
app.py
|
@ -52,8 +52,6 @@ def showMapFromLatLng(lat, lng):
|
|||
# API
|
||||
@get('/api/<lat:float>,<lng:float>')
|
||||
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/<lat:float>,<lng:float>')
|
||||
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/<lat:float>,<lng:float>')
|
||||
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/<threewords>')
|
||||
def hashToLatLng(threewords):
|
||||
|
|
Loading…
Reference in New Issue