-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathschema.py
63 lines (52 loc) · 1.64 KB
/
schema.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
56
57
58
59
60
61
62
63
import json
import requests
import time
from glob import glob
import os
APIURL = os.getenv("URL")
auth = (os.getenv("USERNAME"), os.getenv("PASSWORD"))
res = requests.get(APIURL + "schemas")
for s in res.json():
r = requests.delete(APIURL + "schemas" + "/"+s["id"], auth=auth)
if not r.ok:
print(s["id"])
# with open("schemas.json") as o:
# schemas = json.loads(o.read())
# for s in schemas:
# res = requests.post(APIURL + "schemas", json=s, auth=auth)
# if not res.ok:
# print(s["id"])
# print(res.text)
with open("schemas/counting.json") as o:
schemas = json.loads(o.read())
for schema in schemas:
res = requests.post(APIURL + "schemas", json=schema, auth=auth)
if not res.ok:
print(schema["id"])
print(res.text)
for filename in glob('schemas/ui-schemas/*.json'):
print(filename)
with open(filename) as o:
schema = json.loads(o.read())
res = requests.post(APIURL + "schemas", json=schema, auth=auth)
if not res.ok:
print(schema["id"])
print(res.text)
with open("schemas/landing.json") as o:
schema = json.loads(o.read())
res = requests.post(APIURL + "schemas", json=schema, auth=auth)
if not res.ok:
print(schema["id"])
print(res.text)
# res = requests.get(APIURL + "optimize/refresh", auth=auth)
# res = requests.get(APIURL + "optimize/status", auth=auth)
# while (not res.text=="Ready"):
# time.sleep(2)
# res = requests.get(APIURL + "optimize/status", auth=auth)
# print(res.text)
res = requests.get(APIURL + "summary/refresh", auth=auth)
res = requests.get(APIURL + "summary/status", auth=auth)
print(res.text)
while (not res.text=="Ready"):
time.sleep(2)
res = requests.get(APIURL + "summary/status", auth=auth)