-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy pathcreate_user.py
More file actions
49 lines (32 loc) · 916 Bytes
/
create_user.py
File metadata and controls
49 lines (32 loc) · 916 Bytes
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
'''
Created on April 23, 2019
@author: gsnyder
Create a new user
'''
import argparse
import json
import logging
from pprint import pprint
import sys
from blackduck.HubRestApi import HubInstance
parser = argparse.ArgumentParser("Create a new user")
parser.add_argument("user_name")
parser.add_argument("first_name")
parser.add_argument("last_name")
parser.add_argument("email")
parser.add_argument("password")
parser.add_argument("-d", "--disable", action='store_true')
args = parser.parse_args()
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
hub = HubInstance()
data = {
"userName" : args.user_name,
"firstName" : args.first_name,
"lastName" : args.last_name,
"email" : args.email,
"active" : not args.disable,
"password" : args.password
}
hub.create_user(data)