Lock same api routes

This commit is contained in:
Ruud
2013-09-01 00:24:47 +02:00
parent 1e5d6bad2a
commit af2876bd71
2 changed files with 16 additions and 8 deletions
+3 -3
View File
@@ -25,7 +25,7 @@ class WebHandler(RequestHandler):
if not views.get(route):
page_not_found(self)
return
self.finish(views[route]())
self.write(views[route]())
def addView(route, func, static = False):
views[route] = func
@@ -64,7 +64,7 @@ class KeyHandler(RequestHandler):
if (self.get_argument('u') == md5(username) or not username) and (self.get_argument('p') == password or not password):
api = Env.setting('api_key')
self.finish({
self.write({
'success': api is not None,
'api_key': api
})
@@ -81,5 +81,5 @@ def page_not_found(rh):
time.sleep(0.1)
rh.set_status(404)
rh.finish('Wrong API key used')
rh.write('Wrong API key used')