Below code is running successfully when I am passing HTML script in 'static_report'. How can I pass File name or URL in 'static_report'?
#Converting HTML To PDF
from xhtml2pdf import pisa
def convert_html_to_pdf(source_html, output_filename):
    # open output file for writing (truncated binary)
    result_file = open(output_filename, "w+b")
    # convert HTML to PDF
    pisa_status = pisa.CreatePDF(
            source_html,                # the HTML to convert
            dest=result_file)           # file handle to recieve result
    # close output file
    result_file.close()                 # close output file
    # return True on success and False on errors
    return pisa_status.err
static_report = ""
convert_html_to_pdf(static_report, 'report.pdf')
 
     
    