def on_msg_receive(self, channel, method, properties, body): #记录日志 log_info("=======================================================") log_info("收到消息:%s" % (body)) #字符串转换为对象 img_car = ImgCar.deserialize(body) self.msg_receive_event_handler(img_car)
def img_car_deserialize_test(): img_car_json_str = str(build_img_car()) print 'img_car_json_obj:%s' % img_car_json_str img_car_json_obj = ImgCar.deserialize(img_car_json_str) print 'img_car_json_obj:%s' % str(img_car_json_obj)