Lock same api routes
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user