Update json module to jsonutils

oslo project provide jsonutils, and apmecclient use it
in many place[1], this PS to update the remained json moudule to
oslo jsonutils for consistency.

[1]: https://github.com/openstack/python-apmecclient/search?utf8=%E2%9C%93&q=jsonutils&type=

Change-Id: Id6e3a1d64a54a9858041597c2cda414407f1edb1
This commit is contained in:
cao.yuan 2019-02-24 23:36:39 +08:00
parent 6f0462e4ee
commit d9a8de9e90
1 changed files with 5 additions and 7 deletions

View File

@ -14,13 +14,11 @@
# under the License.
#
try:
import json
except ImportError:
import simplejson as json
import logging
import os
from oslo_serialization import jsonutils
from keystoneclient import access
from keystoneclient import adapter
import requests
@ -209,14 +207,14 @@ class HTTPClient(object):
token_url = self.auth_url + "/tokens"
resp, resp_body = self._cs_request(token_url, "POST",
body=json.dumps(body),
body=jsonutils.dumps(body),
content_type="application/json",
allow_redirects=True)
if resp.status_code != 200:
raise exceptions.Unauthorized(message=resp_body)
if resp_body:
try:
resp_body = json.loads(resp_body)
resp_body = jsonutils.loads(resp_body)
except ValueError:
pass
else:
@ -252,7 +250,7 @@ class HTTPClient(object):
self.authenticate()
return self.endpoint_url
body = json.loads(body)
body = jsonutils.loads(body)
for endpoint in body.get('endpoints', []):
if (endpoint['type'] == 'mec-orchestration' and
endpoint.get('region') == self.region_name):