Created
January 11, 2018 11:03
-
-
Save seanwiseman/46f58ce7509d7cbaf138b569685f4fa3 to your computer and use it in GitHub Desktop.
Small script to import user data for ingestion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import subprocess | |
| base_cmds = ['python', 'manage.py', 'create-profile'] | |
| import_file = 'import_users.json' | |
| def import_users(): | |
| print('*Starting User Import*') | |
| with open(import_file, 'r') as user_file: | |
| user_data = json.load(user_file) | |
| for user in user_data: | |
| args = ['--name', '"{}"'.format(user_data[user]), '--email', '{}'.format(user)] | |
| proc = subprocess.Popen(base_cmds + args) | |
| proc.communicate() | |
| print('*Complete*') | |
| if __name__ == '__main__': | |
| import_users() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment