#!/usr/bin/python3 import requests def get_jobs(url="http://localhost:8898", verify=False): """get_jobs fetch jobs from dkron""" 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:8898", verify=False, job=None): """set_jobs set jobs on dkron""" 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