aboutsummaryrefslogtreecommitdiffstats
path: root/docker-compose/preload-templates/cpspreload.py
blob: 17f14fc7c5c0ba8f105275ba2cf34171c241c777 (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("Waiting before sending request..")
    time.sleep(8)
    print("Sending rest request..")
    response=requests.post(tbdmt_url, json=template, headers=CPS_HEADERS, verify=False)
    print("Response is: ",response.reason)