def get_cert_and_update_domain(zappa_instance, lambda_name, api_stage, domain=None, clean_up=True):
 try:
  create_domain_key()
  create_domain_csr(domain)
  get_cert(zappa_instance)
  create_chained_certificate()
  with open('/tmp/signed.crt') as f:
   certificate_body = f.read()
  with open('/tmp/domain.key') as f:
   certificate_private_key = f.read()
  with open('/tmp/intermediate.pem') as f:
   certificate_chain = f.read()
  if domain:
   if (not zappa_instance.get_domain_name(domain)):
    zappa_instance.create_domain_name(domain, (domain + '-Zappa-LE-Cert'), certificate_body, certificate_private_key, certificate_chain, lambda_name, api_stage)
    print 'Created a new domain name. Please note that it can take up to 40 minutes for this domain to be created and propagated through AWS, but it requires no further work on your part.'
   else:
    zappa_instance.update_domain_name(domain, (domain + '-Zappa-LE-Cert'), certificate_body, certificate_private_key, certificate_chain)
 except Exception as e:
  print e
  return False
 if clean_up:
  cleanup()
 return True

def get_cert_and_update_domain ( zappa_instance , lambda_name , api_stage , domain = None , clean_up = True ) : try : create_domain_key ( ) create_domain_csr ( domain ) get_cert ( zappa_instance ) create_chained_certificate ( ) with open ( '/tmp/signed.crt' ) as f : certificate_body = f . read ( ) with open ( '/tmp/domain.key' ) as f : certificate_private_key = f . read ( ) with open ( '/tmp/intermediate.pem' ) as f : certificate_chain = f . read ( ) if domain : if ( not zappa_instance . get_domain_name ( domain ) ) : zappa_instance . create_domain_name ( domain , ( domain + '-Zappa-LE-Cert' ) , certificate_body , certificate_private_key , certificate_chain , lambda_name , api_stage ) print 'Created a new domain name. Please note that it can take up to 40 minutes for this domain to be created and propagated through AWS, but it requires no further work on your part.' else : zappa_instance . update_domain_name ( domain , ( domain + '-Zappa-LE-Cert' ) , certificate_body , certificate_private_key , certificate_chain ) except Exception as e : print e return False if clean_up : cleanup ( ) return True
main cert installer path .