commit 4459924bafff6f94a8f5b2e5e28dba0ee581c018
parent af689b096de5168d7fbace66d9d4f8629a02bec7
Author: Brian C. Lane <bcl@redhat.com>
Date: Fri, 26 Dec 2014 18:56:54 -0800
Add hard-coded /version
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/clortho.py b/src/clortho.py
@@ -5,10 +5,17 @@ import argparse
import pickle
from aiohttp import web
+VERSION = "0.1"
args = None
keystore = {}
@asyncio.coroutine
+def get_version(request):
+ text = "version: %s" % VERSION
+ status = 200
+ return web.Response(body=text.encode('utf-8'), status=status)
+
+@asyncio.coroutine
def get_key(request):
key = request.match_info.get('key')
@@ -59,6 +66,7 @@ def set_key(request):
@asyncio.coroutine
def init(loop, host, port):
app = web.Application(loop=loop)
+ app.router.add_route('GET', '/version', get_version)
app.router.add_route('GET', '/{key}', get_key)
app.router.add_route('POST', '/{key}', set_key)