X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=api%2Fbase.py;h=6fa2777cedae17871e9a7d276d86ca140292ab09;hb=refs%2Fchanges%2F73%2F36373%2F5;hp=7671527d4b445e67735837723fa53bc1f454962b;hpb=734a4d10e3d3efc0ed869771be56b3cbd9df7602;p=yardstick.git diff --git a/api/base.py b/api/base.py index 7671527d4..6fa2777ce 100644 --- a/api/base.py +++ b/api/base.py @@ -6,6 +6,7 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +from __future__ import absolute_import import re import importlib import logging @@ -22,9 +23,16 @@ logger.setLevel(logging.DEBUG) class ApiResource(Resource): def _post_args(self): - params = common_utils.translate_to_str(request.json) - action = params.get('action', '') + data = request.json if request.json else {} + params = common_utils.translate_to_str(data) + action = params.get('action', request.form.get('action', '')) args = params.get('args', {}) + + try: + args['file'] = request.files['file'] + except KeyError: + pass + logger.debug('Input args is: action: %s, args: %s', action, args) return action, args