aboutsummaryrefslogtreecommitdiffstats
path: root/docker-compose/preload-templates/cpspreload.py
blob: 25fd5680d0f4a12b64b04bea11cd6c7e76718d73 (plain)
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
import json
import time
import requests

CPS_HEADERS = {
   "Accept": "application/json",
   "Content-Type": "application/json",
   }
tbdmt_url="http://cps-tbdmt:8080/templates"
 


with open('samplepreload.json') as template_file:
  templates_json = template_file.read()
templates=json.loads(templates_json)


for template in templates:
    print(type(template))
    print("send rest req")
    print("waiting before sent req")
    time.sleep(2)
    response=requests.post(tbdmt_url, json=template, headers=CPS_HEADERS)
    print("res",response.reason)