Fix python3 json loads error

`oslo_serialization.jsonutils.loads` is a more appropriate solution
Task: 36071
Story: 2006285

Change-Id: I8e2775a283b4670a8979541602a3f245c18e5d35
This commit is contained in:
zhangjianweibj 2019-08-02 08:36:40 +08:00
parent 22d7c9bb51
commit 3db7b179ef

View File

@ -14,14 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json
import time
from monasca_common.kafka import consumer
from monasca_common.kafka import producer
from oslo_config import cfg
from oslo_log import log as logging
from six import PY3
from oslo_serialization import jsonutils
from monasca_notification.common.utils import construct_notification_object
from monasca_notification.common.utils import get_db_repo
@ -51,9 +50,7 @@ class RetryEngine(object):
def run(self):
for raw_notification in self._consumer:
message = raw_notification[1].message.value
message = message.decode('UTF-8') if PY3 else message
notification_data = json.loads(message)
notification_data = jsonutils.loads(message)
notification = construct_notification_object(self._db_repo, notification_data)