Skip to content

Instantly share code, notes, and snippets.

@mihasya
Last active August 29, 2015 14:05
Show Gist options
  • Save mihasya/a1fd1c4bbef04495a12b to your computer and use it in GitHub Desktop.
Save mihasya/a1fd1c4bbef04495a12b to your computer and use it in GitHub Desktop.
#!/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