#!/usr/bin/python3 import requests import json def get_jobs(url="http://localhost:8080", verify=False): fullurl = f"{url}/v1/jobs" ret = dict() try: req = requests.request("get", fullurl, verify=verify) except (requests.exceptions.RequestException) as exc: raise f"Exception {exc} occured" ret = req.json() if req.status_code == 200: return ret return None def set_jobs(url="http://localhost:8080", verify=False, job={}): fullurl = f"{url}/v1/jobs" ret = dict() try: req = requests.request("post", fullurl, verify=verify, json=job) except (requests.exceptions.RequestException) as exc: raise f"Exception {exc} occured" ret = req.json() if req.status_code == 201: return ret return None