in lambda/source/create_add_on_zip.py [0:0]
def fetchProductTemplateData(qsProductTemplate, addOnTemplateCoreFile):
webURL = urllib.request.urlopen(qsProductTemplate)
data = webURL.read()
# created file out of data to pass as parameter to util function
file = "/tmp/templateTestFile"
fileObj = open(file, "wb")
fileObj.write(data)
if (utils.is_json(file) is True) and (utils.is_yaml(file) is False):
jsonObject=json.loads(data.decode('utf-8'))
str = json.dumps(jsonObject, indent=4, sort_keys=True)
elif (utils.is_json(file) is False) and (utils.is_yaml(file) is True):
yamlObject = yaml.load(data)
out = io.StringIO();
yaml.dump(yamlObject, out)
str = out.getvalue()
qsProductTemplateContent=io.StringIO(str)
return (addOnTemplateCoreFile,qsProductTemplateContent)