Send as html

This commit is contained in:
2024-01-30 20:28:43 +01:00
parent d6da261c17
commit 849a076b51
2 changed files with 7 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
from tabulate import tabulate
def format_product_table(product_info):
def format_product_table(product_info, tablefmt="grid"):
headers = ["Product Name", "Price", "Discount", "original price", "URL"]
table_data = [[info["name"], info["price"], info["discount"], info["originalPrice"], info["url"]] for info in product_info]
return tabulate(table_data, headers=headers, tablefmt="grid")
table_data = [[info["name"], info["price"], info["discount"] + "%", info["originalPrice"], info["url"]] for info in product_info]
return tabulate(table_data, headers=headers, tablefmt=tablefmt)