diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2022-05-16 09:07:03 +0200 |
---|---|---|
committer | Jose M. Guisado <jguisado@soleta.eu> | 2022-05-16 15:17:58 +0200 |
commit | 828d6c0ce7d4a6b4bcd95e97155460fd59856bdd (patch) | |
tree | 335856939f249750c68843b735d5a086ec686de8 | |
parent | eb5091d3744126b200c012d8c6a52e4b9c8cff22 (diff) |
list scopes: pretty print scope tree
Use json module to pretty print the scope tree. JSON keys are ordered
and two-space indentation is used.
-rw-r--r-- | cli/objects/scopes.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cli/objects/scopes.py b/cli/objects/scopes.py index 4b8fa95..3517e43 100644 --- a/cli/objects/scopes.py +++ b/cli/objects/scopes.py @@ -5,9 +5,12 @@ # Free Software Foundation; either version 3 of the License, or # (at your option) any later version. +import json + class OgScope(): @staticmethod def list_scopes(rest): r = rest.get('/scopes') - print(r.text) + payload = json.loads(r.text) + print(json.dumps(payload, sort_keys=True, indent=2)) |