in processing-pipelines/bigquery/notifier/python/app.py [0:0]
def notify(bucket, name):
app.logger.info(f"notify with bucket '{bucket}' and name '{name}'")
image_url = f'https://storage.cloud.google.com/{bucket}/{name}'
app.logger.info(f"Sending email to '{to_emails}''")
message = Mail(
from_email=from_email,
to_emails=to_emails,
subject='A new chart from BigQuery Pipeline',
html_content=f'<html><p>A new chart is available for you to view: <a href="{image_url}">{image_url}</a></p><img src="{image_url}"></img></html>')
try:
app.logger.info(f"Email content {message}")
sg = SendGridAPIClient(sendgrid_api_key)
response = sg.send(message)
app.logger.info(f"Email status code {response.status_code}")
except Exception as e:
app.logger.error(f"Exception in sending email: {e}")
print(e)