mirror of
https://github.com/Sneed-Group/pypush-plus-plus
synced 2024-12-23 11:22:42 -06:00
use json to make the output a bit nicer
This commit is contained in:
parent
c68d710952
commit
26e4257cac
1 changed files with 14 additions and 1 deletions
15
ids.py
15
ids.py
|
@ -105,4 +105,17 @@ body = response['b']
|
|||
body = zlib.decompress(body, 16 + zlib.MAX_WBITS)
|
||||
body = plistlib.loads(body)
|
||||
|
||||
print(f"Body: {body}")
|
||||
# Recurse over the entire body, replacing all bytes with base64 encoded strings
|
||||
def recurse(obj):
|
||||
if isinstance(obj, bytes):
|
||||
return b64encode(obj).decode()
|
||||
elif isinstance(obj, dict):
|
||||
return {k: recurse(v) for k, v in obj.items()}
|
||||
elif isinstance(obj, list):
|
||||
return [recurse(v) for v in obj]
|
||||
return obj
|
||||
|
||||
body = recurse(body)
|
||||
|
||||
import json
|
||||
print(json.dumps(body, indent=4))
|
Loading…
Reference in a new issue