#!/usr/bin/python3 # vim:syntax=python import os import requests def write_file_content(content=None, file=None): ret = None try: with open(file, "w") as f: ret = f.write(content) except Exception as err: pass return def get_file_content(checkfile=None): ret = None try: with open(checkfile, 'r') as f: ret = f.read() except FileNotFoundError as err: pass return ret def get_pki_cert(url="http://pki", username=None, password=None, domains=None): ret = None try: res = requests.request(method="GET", url=f"{url}/domain/{domains}", auth=(username, password)) resj = res.json() return resj["certificate"], resj["privatekey"] except Exception as err: pass return None, None