def main(argv): """Process the JSON data and generate a full report out of it.""" data = load_data( r"C:\Users\kyleh\OneDrive\Education\Coursera\Google IT Automation with Python\Automating Real-World Tasks with Python\Week 3\Resources\Automatically Generate a PDF and send it by Email\car_sales.json" ) summary = process_data(data) # new_summary = '<br/>'.join(summary) print(summary) # TODO: turn this into a PDF report report = SimpleDocTemplate( r"C:\Users\kyleh\OneDrive\Education\Coursera\Google IT Automation with Python\Automating Real-World Tasks with Python\Week 3\Resources\Automatically Generate a PDF and send it by Email\Car Sales Report.pdf" ) styles = getSampleStyleSheet() report_title = Paragraph("Last Months Sales Summary", styles["h1"]) table_style = [('GRID', (0, 0), (-1, -1), 0.5, colors.black)] new_summary = [[x] for x in summary] report_table = Table(new_summary, style=table_style, hAlign="LEFT") report.build([report_title, report_table]) # TODO: send the PDF report as an email attachment msg = email_generate("*****@*****.**", "*****@*****.**", "Sales summary for last month", new_summary, "/tmp/cars.pdf") email_send(msg)
def main(argv): data = load_data("/home/student-04-b36fbde96c4c/car_sales.json") summary = process_data(data) new_summary = '<br/>'.join(summary) print(summary) report('/tmp/cars.pdf',"Cars report",new_summary,cars_dict_to_table(data)) msg = email_generate("*****@*****.**","*****@*****.**","Sales summary for last month", new_summary, "/tmp/cars.pdf") email_send(msg)
def main(argv): """Process the JSON data and generate a full report out of it.""" data = load_data("/home/student-00-e0f8d165ca2a/car_sales.json") summary = process_data(data) new_summary = '<br/>'.join(summary) print(summary) # TODO: turn this into a PDF report report('/tmp/cars.pdf', "Cars report", new_summary, cars_dict_to_table(data)) # TODO: send the PDF report as an email attachment msg = email_generate("*****@*****.**", "<username>@example.com", "Sales summary for last month", new_summary, "/tmp/cars.pdf") email_send(msg)
def main(argv): """Process the JSON data and generate a full report out of it.""" data = load_data("car_sales.json") summary = process_data(data) new_summary = '<br/>'.join(summary) print(summary) # TODO: turn this into a PDF report report('/tmp/cars.pdf', "Cars report", new_summary, cars_dict_to_table(data)) # TODO: send the PDF report as an email attachment msg = email_generate("*****@*****.**", "{}@example.com".format(os.environ.get('USER')), "Sales summary for last month", new_summary, "/tmp/cars.pdf") email_send(msg)
def main(argv): """Process the JSON data and generate a full report out of it.""" data = load_data("../car_sales.json") summary = process_data(data) new_summary = '\n'.join(summary) print(summary) # TODO: turn this into a PDF report report('/tmp/cars.pdf', "Cars Report", new_summary, cars_dict_to_table(data)) # TODO: send the PDF report as an email attachment message = email_generate('*****@*****.**', '*****@*****.**', 'Sales summary for last month', new_summary, '/tmp/cars.pdf') email_send(message)