title: Generating Flask HTML template without rendering in browser?
body: <p>I am trying to generate HTML files to use for:</p>
  <ul>
  <li>Email Templates, and</li>
  <li>Generate PDF files</li>
  </ul>
  <p>The problem I am facing is that I want to generate the HTML, and then push it to the applicable PDF generator and/or email API. However, the only way I know how to do it in Flask is to use <code>render_template</code> which, even when used without <code>return</code> seems to mess up the content rendered in the web-browser.</p>
  <p>For example, my email function is:</p>
  <pre><code>def EmailSenderHTML(to,subject,info, date, user):
      sender = {&quot;name&quot;:&quot;app&quot;,&quot;email&quot;:&quot;email@email.com&quot;}
      replyTo = {&quot;name&quot;:&quot;app&quot;,&quot;email&quot;:&quot;email@email.com&quot;}
      to = [{&quot;email&quot;: to}]
      html_content = render_template(&quot;ReportTemplate.html&quot;, records=info, todayDate=date, user=user)
      send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(to=to, reply_to=replyTo, html_content=html_content, sender=sender, subject=subject)
      try:
          api_response = api_instance.send_transac_email(send_smtp_email)
          print(api_response)
      except ApiException as e:
          print(&quot;Exception when calling SMTPApi-&gt;send_transac_email: %s\n&quot; % e)
  </code></pre>
  <p>The email generates perfectly fine, but as I mentioned above, it seemingly renders the template (which makes sense).</p>
  <p>How do I generate the HTML without actually rendering the content?</p>