in SubTemplates/IoT/Lambdas/provision_device/app.py [0:0]
def createClient(certificates, iotEndpoint):
mem_zip = BytesIO()
clientDir = "{}/{}".format(scriptPath, 'client')
with ZipFile(mem_zip, mode="w", compression=ZIP_DEFLATED) as client:
for root, subFolder, files in os.walk(clientDir):
for file in files:
fullPath = root + '/' + file
data = updateConfig(fullPath, file, iotEndpoint)
client.writestr(fullPath.split('client/')[1], data)
print('got to here')
client.writestr(certLocation, certificates['certificatePem'])
client.writestr(keyLocation, certificates['keyPair']['PrivateKey'])
rootCert = urlopen(rootCertUrl)
client.writestr("certs/root.ca.pem", rootCert.read())
mem_zip.seek(0)
return mem_zip