def send_reminder(): reminder_days_before_game = 4 if (Game.get_next_game().date.date() - datetime.datetime.now().date() ).days == reminder_days_before_game: if os.environ.get("environment") in ['QA', 'DEV']: email_to = '*****@*****.**' else: email_to = UserGame.get_reminder_user_list() next_game = Game.get_next_game() template = jinja2.Template(UserGameConstants.templateHtml) html = template.render(next_game=next_game, deadline=next_game.date - datetime.timedelta(days=3), opponent=next_game.get_opponent()) response = requests.post( UserGameConstants.URL, auth=('api', UserGameConstants.API_KEY), data={ "from": UserGameConstants.FROM, "to": UserGameConstants.FROM, "bcc": email_to, "subject": "Friendly Reminder to Submit Scores for {} Game".format( next_game.get_opponent()), "html": html }) response.raise_for_status()
def send(self): if os.environ.get("environment") in ['QA', 'DEV']: email_to = '[email protected],[email protected]' else: email_to = self.get_preview_user_list() next_game = Game.get_next_game() response = requests.post(PreviewConstants.URL, auth=('api', PreviewConstants.API_KEY), data={ "from": PreviewConstants.FROM, "to": PreviewConstants.FROM, "bcc": email_to, "subject": "HHT Preview for {} Game".format( next_game.get_opponent()), "html": self.preview }) response.raise_for_status()