prettier emails
This commit is contained in:
@@ -22,7 +22,7 @@ SOURCES = ["plato", "sounds"]
|
||||
logger = structlog.get_logger()
|
||||
|
||||
daily_partitions_def = dg.DailyPartitionsDefinition(
|
||||
start_date="2024-09-01", end_offset=1, timezone=os.environ["TZ"]
|
||||
start_date="2024-09-01", end_offset=1, timezone=os.environ.get("TZ", "UTC")
|
||||
)
|
||||
multi_partitions_def = dg.MultiPartitionsDefinition(
|
||||
{
|
||||
@@ -235,13 +235,32 @@ def good_deals(
|
||||
yield dg.Output(Deal.DataFrame(filtered_df))
|
||||
|
||||
lines = []
|
||||
lines.append(
|
||||
"""
|
||||
<div style="font-family: Arial, sans-serif; background-color: #f4f4f4; padding: 20px;">
|
||||
<h2 style="color: #333;">🎶 New Music Releases</h2>
|
||||
"""
|
||||
)
|
||||
|
||||
# Each item
|
||||
for data in filtered_df.head(10).iter_rows(named=True):
|
||||
row = SimpleNamespace(**data)
|
||||
lines.append(f'<a href="https://www.platomania.nl{row.url}"><h1>NEW</h1></a>')
|
||||
lines.append("<ul>")
|
||||
lines.append(f"<li>[artist] {row.artist}</li>")
|
||||
lines.append(f"<li>[title] {row.title}</li>")
|
||||
lines.append(f"<li>[price] {row.price}</li>")
|
||||
lines.append(f"<li>[release] {row.release}</li>")
|
||||
lines.append("</ul>")
|
||||
lines.append(
|
||||
f"""
|
||||
<div style="background-color: #fff; margin-bottom: 20px; padding: 15px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05);">
|
||||
<a href="https://www.platomania.nl{row.url}" style="text-decoration: none; color: #1a73e8;">
|
||||
<h3 style="margin: 0 0 10px;">🆕 {row.artist} - {row.title}</h3>
|
||||
</a>
|
||||
<ul style="list-style: none; padding-left: 0; margin: 0;">
|
||||
<li><strong>Artist:</strong> {row.artist}</li>
|
||||
<li><strong>Title:</strong> {row.title}</li>
|
||||
<li><strong>Price:</strong> €{row.price}</li>
|
||||
<li><strong>Release Date:</strong> {row.release}</li>
|
||||
</ul>
|
||||
</div>
|
||||
"""
|
||||
)
|
||||
|
||||
# Email footer
|
||||
lines.append("</div>")
|
||||
email_service.send_email("\n".join(lines))
|
||||
|
||||
Reference in New Issue
Block a user