Create a gist now

Instantly share code, notes, and snippets.

#!/usr/bin/env python
from sys import stdin
import json
import base64
report = json.loads(stdin.read())
table = base64.b64decode(report["Content"]).splitlines()
head = table[0].split(",")
table = table[1:]
for row in iter(table):
user = dict(zip(head, row.split(",")))
# you now have a dictionary with keys like `user`, `mfa_active`,
# and `password_last_changed`
print "%s %s" % (user["user"], user["mfa_active"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment