def main(): parser = argparse.ArgumentParser('Chatbot Server') parser.add_argument( '-p', '--port', dest='port', type=int, default=8001, help='Server port') parser.add_argument( '-v', '--verbose', dest='verbose', action='store_true', help='Verbose') option = parser.parse_args() root_logger = logging.getLogger() if option.verbose: for h in root_logger.handlers: h.setLevel(logging.INFO) else: for h in root_logger.handlers: h.setLevel(logging.WARN) if 'HR_CHATBOT_SERVER_EXT_PATH' in os.environ: sys.path.insert(0, os.path.expanduser( os.environ['HR_CHATBOT_SERVER_EXT_PATH'])) import ext ext.load(app, ROOT) app.run(host='0.0.0.0', debug=False, use_reloader=False, port=option.port)
def main(): parser = argparse.ArgumentParser('Chatbot Server') parser.add_argument( '-p, --port', dest='port', default=8001, help='Server port') parser.add_argument( '-v, --verbose', dest='verbose', action='store_true', help='Verbose') option = parser.parse_args() if option.verbose: fh.setLevel(logging.INFO) sh.setLevel(logging.INFO) else: fh.setLevel(logging.INFO) sh.setLevel(logging.WARN) if 'HR_CHATBOT_SERVER_EXT_PATH' in os.environ: sys.path.insert(0, os.path.expanduser( os.environ['HR_CHATBOT_SERVER_EXT_PATH'])) import ext ext.load(app, ROOT) app.run(host='0.0.0.0', debug=False, use_reloader=False, port=option.port)
ret = True except Exception as ex: ret, response = False, {'err_msg': str(ex)} logger.error(ex) return Response(json_encode({'ret': ret, 'response': response}), mimetype="application/json") if __name__ == '__main__': parser = argparse.ArgumentParser('Chatbot Server') parser.add_argument( '-p, --port', dest='port', default=8001, help='Server port') parser.add_argument( '-v, --verbose', dest='verbose', action='store_true', help='Verbose') option = parser.parse_args() if option.verbose: root_logger.setLevel(logging.INFO) else: root_logger.setLevel(logging.WARN) if 'HR_CHATBOT_SERVER_EXT_PATH' in os.environ: sys.path.insert(0, os.path.expanduser( os.environ['HR_CHATBOT_SERVER_EXT_PATH'])) import ext ext.load(app, ROOT) app.run(host='0.0.0.0', debug=False, use_reloader=False, port=option.port)
mimetype="application/json") if __name__ == '__main__': parser = argparse.ArgumentParser('Chatbot Server') parser.add_argument('-p, --port', dest='port', default=8001, help='Server port') parser.add_argument('-v, --verbose', dest='verbose', action='store_true', help='Verbose') option = parser.parse_args() if option.verbose: fh.setLevel(logging.INFO) sh.setLevel(logging.INFO) else: fh.setLevel(logging.INFO) sh.setLevel(logging.WARN) if 'HR_CHATBOT_SERVER_EXT_PATH' in os.environ: sys.path.insert( 0, os.path.expanduser(os.environ['HR_CHATBOT_SERVER_EXT_PATH'])) import ext ext.load(app, ROOT) app.run(host='0.0.0.0', debug=False, use_reloader=False, port=option.port)