Skip to content

Instantly share code, notes, and snippets.

@cnelson
Created March 14, 2017 14:43
Show Gist options
  • Save cnelson/03e1cbaf0ce1472ef67fc765c3eb70e8 to your computer and use it in GitHub Desktop.
Save cnelson/03e1cbaf0ce1472ef67fc765c3eb70e8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import re
import subprocess
import yaml
import datetime
since=datetime.datetime(2017, 2, 28, 0, 0, 0)
# get one user toget the total number
check = yaml.load(subprocess.check_output(['uaac', 'users', '--attributes', 'username', '--count', '1']))
total = check['totalresults']
data = yaml.load(subprocess.check_output(['uaac', 'users', '--attributes', 'username', '--attributes', 'meta.created', '--attributes', 'verified', '--count', str(total)]))
assert data['itemsperpage'] == total
is_email=r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
for user in data['resources']:
if re.match(is_email, user['username']) and user['meta.created'] >= since:
user['created'] = user['meta.created']
print("{username}\t{created}".format(**user))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment