def send_completion_email():
    subject = "[Impeachment Tweet Analysis] Friend Collection Complete!"
    html = f"""
    <h3>Nice!</h3>
    <p>Server '{SERVER_NAME}' has completed its work.</p>
    <p>So please shut it off so it can get some rest.</p>
    <p>
        <a href='{SERVER_DASHBOARD_URL}'>{SERVER_DASHBOARD_URL}</a>
    </p>
    <p>Thanks!</p>
    """
    response = send_email(subject, html)
    return response
 def send_completion_email(self, subject="[Tweet Analyzer] Graph Complete!"):
     if APP_ENV == "production":
         html = f"""
             <h3>Nice!</h3>
             <p>Server '{SERVER_NAME}' has completed its work.</p>
             <p>So please shut it off so it can get some rest.</p>
             <p>
                 <a href='{SERVER_DASHBOARD_URL}'>{SERVER_DASHBOARD_URL}</a>
             </p>
             <p>Thanks!</p>
         """
         response = send_email(subject, html)
         return response
Esempio n. 3
0
from app.weather_service import get_hourly_forecasts
from app.email_service import send_email

load_dotenv()

MY_NAME = os.getenv("MY_NAME", default="Player 1")

if __name__ == "__main__":

    if APP_ENV == "development":
        zip_code = input("PLEASE INPUT A ZIP CODE (e.g. 06510): ")
        weather_results = get_hourly_forecasts(zip_code=zip_code) # invoke with custom params
    else:
        weather_results = get_hourly_forecasts() # invoke with default params

    #print(weather_results)

    html = ""
    html += f"<h3>Good Morning, {MY_NAME}!</h3>"

    html += "<h4>Today's Date</h4>"
    html += f"<p>{date.today().strftime('%A, %B %d, %Y')}</p>"

    html += f"<h4>Weather Forecast for {weather_results['city_name'].title()}</h4>"
    html += "<ul>"
    for hourly in weather_results["hourly_forecasts"]:
        html += f"<li>{hourly['timestamp']} | {hourly['temp']} | {hourly['conditions'].upper()}</li>"
    html += "</ul>"

    send_email(subject="[Daily Briefing] My Morning Report", html=html)
Esempio n. 4
0
    "value": third_symbol,
    "start_price": latest_open3,
    "end_price": latest_close3
}

#print(dict3)
#breakpoint

if __name__ == "__main__":
    subject = "Market Closing "  #This tests to make sure the email capabilities are working correctly

    html = f""" 
    <body style="background-color:whitesmoke;">
    <h2 style="color: darkslateblue;">Good Evening, here are your daily closing prices!</h3>
    <h4 style="color: grey;">Today's Date</h4>
    <p style="color: grey;">{date.today().strftime('%A, %B %d, %Y')}</p>
    <h2 style="color: darkslateblue;">My Stocks</h4>
    <h4 style="color: slateblue;">{symbol}</H4>
        <p>Opening Price: {to_usd(float(latest_open))}</p>
        <p>Closing Price: {to_usd(float(latest_close))}</p>
    <h4 style="color: slateblue;">{second_symbol}</H4>
        <p>Opening Price: {to_usd(float(latest_open2))}</p>
        <p>Closing Price: {to_usd(float(latest_close2))}</p>
    <h4 style="color: slateblue;">{third_symbol}</H4>
        <p>Opening Price: {to_usd(float(latest_open3))}</p>
        <p>Closing Price: {to_usd(float(latest_close3))}</p>
    <h2 style="color: darkslateblue;">Have a good night!</h2>
    """

    send_email(subject, html)
Esempio n. 5
0
            symbol=symbol)  # invoke with custom params
    else:
        stock_info = process_stock_info()  # invoke with default params

    last_trading_date = stock_info["Date"].max()  # get last trading date
    stock_info_last_date = stock_info[
        stock_info.Date ==
        last_trading_date]  # filter only info from the last trading date
    stock_info_plot = stock_info[(stock_info.Events == "open") |
                                 (stock_info.Events
                                  == "close")]  # filter open and close price
    LinePlot(stock_info_plot, symbol)

    html = ""
    html += f"<h3>Good Afternoon, {MY_NAME}!</h3>"

    html += "<h4>Today's Date</h4>"
    html += f"<p>{date.today().strftime('%A, %B %d, %Y')}</p>"

    html += f"<h4>Stock Information for {symbol} on {last_trading_date}</h4>"
    html += "<ul>"
    for index, row in stock_info_last_date.iterrows():
        if row['Events'] == "volume":
            html += f"<li>{row['Events']} : {to_numeric(row['Values'])} </li>"
        else:
            html += f"<li>{row['Events']} : {to_usd(row['Values'])} </li>"
    html += "</ul>"
    html += "<img src = 'historic_trend.png'>"

    send_email(subject="[Daily Briefing] My Market Report", html=html)
Esempio n. 6
0
        # print a final goodbye message
        html += "<h3>Thank you for using the COVID-19 County Tracker.</h3>"

        # this will include the plotly graph in the email
        plotly_graph(deaths_array, cases_array)
        graph = "https://plotly.com/~sma299/1/#plot"
        template = (
            ''
            '<a href="{graph_url}" target="_blank">'  # Open the interactive graph when you click on the image
            '<img src="{graph_url}.png">'  # Use the ".png" magic url so that the latest, most-up-to-date image is included
            '</a>'
            '{caption}'  # Optional caption to include below the graph
            '<br>'  # Line break
            '<a href="{graph_url}" style="color: rgb(190,190,190); text-decoration: none; font-weight: 200;" target="_blank">'
            'Click to comment and see the interactive graph'  # Direct readers to Plotly for commenting, interactive graph
            '</a>'
            '<br>'
            '<hr>'  # horizontal line
            '')

        _ = template.format(graph_url=graph, caption='')
        html += _

        # send the email
        send_email(subject="COVID-19 Daily County Report", html=html)

    else:  # error message
        print(
            "Unfortunately, that state and county combination does not exist in our database. Please try again."
        )