(self)
return resp
the view_func passed to Flask.add_url_rule
the view_func passed to Flask.add_url_rule
the view_func passed to Flask . add_url_rule
def view_func(self):
        """the view_func passed to Flask.add_url_rule"""
        if request.method == 'OPTIONS':
            resp = Response('', 200)
            resp.headers['Access-Control-Allow-Origin'] = '*'
            resp.headers['Access-Control-Allow-Headers'] = \
                'Content-Type, Origin, Accept'
            return resp
        rst = self.api_implementation()
        assert isinstance(rst, dict), \
            "ret value {0} is not a dict".format(str(rst))
        callback = request.values.get('callback')
        if callback and VALID_CALLBACK_RE.match(callback) is not None:
            rst = '{}({})'.format(callback, json.dumps(rst))
        else:
            rst = json.dumps(rst, indent=4)
        resp = Response(rst, 200, mimetype='application/json')
        resp.headers['Access-Control-Allow-Origin'] = '*'
        resp.headers['Access-Control-Allow-Headers'] = \
            'Content-Type, Origin, Accept'
        return resp
def view_func ( self ) : if request . method == 'OPTIONS' : resp = Response ( '' , 200 ) resp . headers [ 'Access-Control-Allow-Origin' ] = '*' resp . headers [ 'Access-Control-Allow-Headers' ] = 'Content-Type, Origin, Accept' return resp rst = self . api_implementation ( ) assert isinstance ( rst , dict ) , "ret value {0} is not a dict" . format ( str ( rst ) ) callback = request . values . get ( 'callback' ) if callback and VALID_CALLBACK_RE . match ( callback ) is not None : rst = '{}({})' . format ( callback , json . dumps ( rst ) ) else : rst = json . dumps ( rst , indent = 4 ) resp = Response ( rst , 200 , mimetype = 'application/json' ) resp . headers [ 'Access-Control-Allow-Origin' ] = '*' resp . headers [ 'Access-Control-Allow-Headers' ] = 'Content-Type, Origin, Accept' return resp