diff options
author | cao.yuan <cao.yuan@99cloud.net> | 2019-02-25 00:26:24 +0800 |
---|---|---|
committer | caoyuan <cao.yuan@99cloud.net> | 2019-02-25 11:35:14 +0000 |
commit | 7a8ed5e3126b0f1969b93c39b626966731c6e7b5 (patch) | |
tree | 78f33716401acc5785d29908ec9f22cb7e3c6e76 /examples | |
parent | 6c4bb8b529edc2e619fdda212f21dca8160decad (diff) | |
download | python-keystoneclient-7a8ed5e3126b0f1969b93c39b626966731c6e7b5.tar.gz |
Update json module to jsonutils
oslo project provide jsonutils, and keystoneclient use it in many place[1],
this PS to update the remained json module to oslo jsonutils for
consistency.
[1]: https://github.com/openstack/python-keystoneclient/search?utf8=%E2%9C%93&q=jsonutils&type=
Change-Id: Id5275b5e6b5bf8f6d54406dac7ab95a30828cf58
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pki/gen_cmsz.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/pki/gen_cmsz.py b/examples/pki/gen_cmsz.py index 6840c08..bd0d886 100644 --- a/examples/pki/gen_cmsz.py +++ b/examples/pki/gen_cmsz.py @@ -12,9 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -import json import os +from oslo_serialization import jsonutils + from keystoneclient.common import cms from keystoneclient import utils @@ -44,7 +45,7 @@ def generate_revocation_list(): 'id': id, "expires": "2112-08-14T17:58:48Z" }) - revoked_json = json.dumps({"revoked": revoked_list}) + revoked_json = jsonutils.dumps({"revoked": revoked_list}) with open(make_filename('cms', 'revocation_list.json'), 'w') as f: f.write(revoked_json) encoded = cms.pkiz_sign(revoked_json, @@ -91,12 +92,12 @@ for name in EXAMPLE_TOKENS: # validate the JSON try: - token_data = json.loads(string_data) + token_data = jsonutils.loads(string_data) except ValueError as v: raise SystemExit('%s while processing token data from %s: %s' % (v, json_file, string_data)) - text = json.dumps(token_data).encode('utf-8') + text = jsonutils.dumps(token_data).encode('utf-8') # Uncomment to record the token uncompressed, # useful for debugging |