add api debug flag
This commit is contained in:
parent
aae3407860
commit
ca3909abed
2 changed files with 5 additions and 1 deletions
|
@ -19,6 +19,7 @@ import logging
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
def json_response(data=None, status=200, text='ok'):
|
||||
if not data:
|
||||
data = {}
|
||||
|
@ -76,6 +77,7 @@ def defaultcontext():
|
|||
|
||||
@run_async
|
||||
def api_task(context, request, callback):
|
||||
import settings
|
||||
if context == None:
|
||||
context = defaultcontext
|
||||
action = request.arguments.get('action', [None])[0].decode('utf-8')
|
||||
|
@ -89,6 +91,7 @@ def api_task(context, request, callback):
|
|||
'doc': actions.doc(f).replace('\n', '<br>\n')})
|
||||
response = json_response(api)
|
||||
else:
|
||||
if settings.DEBUG_API:
|
||||
logger.debug('API %s %s', action, data)
|
||||
f = actions.get(action)
|
||||
if f:
|
||||
|
|
|
@ -87,5 +87,6 @@ VERSION = "%s.%s" % (NODE_PROTOCOL, MINOR_VERSION)
|
|||
USER_AGENT = 'OpenMediaLibrary/%s' % VERSION
|
||||
|
||||
DEBUG_HTTP = server.get('debug_http', False)
|
||||
DEBUG_API = server.get('debug_api', False)
|
||||
|
||||
DB_VERSION = 13
|
||||
|
|
Loading…
Reference in a new issue