-
Notifications
You must be signed in to change notification settings - Fork 1
/
seed.py
executable file
·32 lines (24 loc) · 890 Bytes
/
seed.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
#!/usr/bin/python3
import requests
ams_url = "https://ams.zpi.localtest.me"
redirect_url = "https://demo.zpi.localtest.me/"
headers = {
'Content-type': 'application/json',
'Accept': 'application/json'
}
crt = 'proxy/certs/out/localhost.crt'
r = requests.post(
ams_url + "/api/manager/signin", headers=headers, json={'username': 'admin', 'password': 'admin'}, verify=crt)
token = r.text
print(r.text)
auth_headers = {
'Authorization': f'Bearer {token}',
'Content-type': 'application/json',
'Accept': 'application/json'
}
r = requests.post(ams_url + "/api/clients", headers=auth_headers,
json={'id': '2', 'availableRedirectUris': [redirect_url]}, verify=crt)
print(r, r.text)
r = requests.post(ams_url + "/api/users", headers=headers,
json={'username': '[email protected]', 'email': '[email protected]'}, verify=crt)
print(r, r.text)