-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcreateAccounts.py
executable file
·55 lines (43 loc) · 1.36 KB
/
createAccounts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/python
import csv
def create_account(
account_name,
account_email,
account_role,
access_to_billing,
organization_unit_id,
scp):
print "create_account(): I got account " + account_name
# create_account()
def main():
lstAccounts = []
# read the CSV file into a list called accounts
with open('accountList.csv') as filAccountList:
reader = csv.DictReader(filAccountList)
for row in reader:
lstAccounts.append(row)
filAccountList.close()
intNumberOfAccounts = len(lstAccounts)
print "Read " + str(intNumberOfAccounts) + " accounts from the input file"
# print lstAccounts
account_name=""
account_email=""
account_role=""
access_to_billing=""
organization_unit_id=""
scp=""
# print all the accounts
for account in lstAccounts:
try:
account_name=account['account_name']
account_email=account['account_email']
account_role=account['account_role']
access_to_billing=account['access_to_billing']
organization_unit_id=account['organization_unit_id']
except KeyError:
pass
create_account(account_name, account_email, account_role,
access_to_billing, organization_unit_id, scp)
# for account in lstAccounts
# main()
main()