def get_daily_update() -> Tweet: """Return Tweet containing daily update on Infection and Death numbers""" URL = "https://www.worldometers.info/coronavirus/country/us/" data = _scrape_worldometers_data(URL) tweet_str = _construct_tweet_str(data) tweet = Tweet() tweet.attach_text(tweet_str) return tweet
def get_daily_infection_plot() -> Tweet: """Return Tweet object with attached image and text""" url = 'https://www.worldometers.info/coronavirus/country/us/' df = _get_daily_infections_data(url) df = _prepare_data(df) _create_full_plot(df) img_fpath = _save_plot() tweet = Tweet() todays_date = datetime.datetime.now().strftime("%m/%d/%Y") tweet_str = ("United States - Infections per Day\n" f"{todays_date}\n" "https://www.worldometers.info/coronavirus/country/us/") tweet.attach_text(tweet_str) tweet.attach_image(img_fpath) return tweet