def post(self): logger.info("request remote client id is %s ..." % self.request.remote_ip) if self.request.body is None or len(self.request.body) == 0: self.response_json(None, -1, 'Invalid param!') logger.info("[Request]:%s" % self.request.body) try: params = json.loads(self.request.body) if not params.has_key('model'): if params.has_key('type') and params['type'] == 'mysql': params['model'] = "default" elif params.has_key('type') and params['type'] == 'mssql': params['model'] = "dbo" elif params.has_key('type') and params['type'] == 'oracle': params['model'] = params['user'] elif params.has_key('type') and params['type'] == 'postgresql': params['model'] = "public" else: pass ret = yield self.query_table_lists(**params) self.response_json(ret) except Exception as e: self.response_json(None, -1, 'error:%s' % str(e.args)) finally: pass
def response_json(self, data, errcode=0, errmsg='ok'): result = { "errcode": errcode, "errmsg": errmsg, "data": data if data is not None else '' } resp = json.dumps(result) logger.info("[Response]:%s" % resp) self.finish(result)
def post(self): logger.info("request remote client id is %s ..." % self.request.remote_ip) if self.request.body is None or len(self.request.body) == 0: self.response_json(None, -1, 'Invalid param!') logger.info("[Request]:%s" % self.request.body) try: params = json.loads(self.request.body) self.query_table_lists(**params) except Exception, e: self.response_json(None, -1, 'error:%s' % e.message)
def post(self): logger.info("request remote client id is %s ..." % self.request.remote_ip) if self.request.body is None or len(self.request.body) == 0: self.response_json(None, -1, 'Invalid param!') logger.info("[Request]:%s" % self.request.body) try: params = json.loads(self.request.body) ret = yield self.query_sql_test(**params) self.response_json(ret) except Exception as e: self.response_json(None, -1, 'error:%s' % str(e.args)) finally: pass
def post(self): logger.info("[Request-POST]:%s" % self.request.uri) self.response_json(None, 404, 'Not found!')