def put(self, name): config = Config() args = request.json if 'value' in args: config.set(name, args['value']) config.save() return {'status': 'successful'} else: return {'status': 'error.'}
def post(self): args = request.json if not isinstance(args, dict): return {'errCode': 301, 'msg': 'body 值错误!'} config = Config() for key, value in args.items(): config.set(key, value) config.save() return {'status': 'successful.'}