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.
master
Jose M. Guisado 2022-05-16 09:07:03 +02:00
parent eb5091d374
commit 828d6c0ce7
1 changed files with 4 additions and 1 deletions

View File

@ -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))