From 34a18b6eca9c3586c106efdebbd579c39e4006c6 Mon Sep 17 00:00:00 2001 From: Kevin Dungs Date: Mon, 17 Nov 2014 11:44:55 +0100 Subject: [PATCH] Add simple webservice. --- server.py | 27 +++++++++++++++++++++++++++ views/index.html | 47 +++++++++++++++++++++++++++++++++++++++++++++++ views/map.html | 24 ++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100755 server.py create mode 100644 views/index.html create mode 100644 views/map.html diff --git a/server.py b/server.py new file mode 100755 index 0000000..97a7e62 --- /dev/null +++ b/server.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +from bottle import ( + get, + run, + template +) + +import thesethreewords as these + + +@get('/') +def index(): + return template('index', err=None) + +@get('/') +def showMap(threewords): + try: + lat, lng = these.decode(threewords) + return template('map', lat=lat, lng=lng) + except: + return template('index', + err="Could not find location {}".format(threewords)) + + +if __name__ == '__main__': + run(host='localhost', port=8080) diff --git a/views/index.html b/views/index.html new file mode 100644 index 0000000..1a90a62 --- /dev/null +++ b/views/index.html @@ -0,0 +1,47 @@ + + + + + + + these-3-words Map + + + + +
+ % if err: + + % end +
+

These3Words Map

+

+ Find a location anywhere in the word identified by three simple words. +

+

+ +

+

+ +

+
+ +
+ + diff --git a/views/map.html b/views/map.html new file mode 100644 index 0000000..345846d --- /dev/null +++ b/views/map.html @@ -0,0 +1,24 @@ + + + + + + + + +
+ +