def summarise_log(): print("Summarising the log") logging.info("Summarising the daily logs into a weekly log") # concatenate all the daily logs for the week # create a new note in weekly logs with that content evernote_client = EvernoteConnector(token=settings.EVERNOTE_AUTH_TOKEN, sandbox=settings.EVERNOTE_SANDBOX_MODE) # The week is Monday 00:00:00 to Sunday 23:59:59 start_time = get_start_of_week(datetime.now()) end_time = get_end_of_week(datetime.now()) try: summary_content = evernote_client.get_concatenated_daily_logs(start_time, end_time) first_day_of_this_week = datetime.now() - timedelta(days=datetime.now().weekday()) summary_title = datetime.strftime(first_day_of_this_week,"W/C %Y-%m-%d") evernote_client.create_summary_log("Summaries", summary_title, summary_content) logging.info("Completed summarising the daily logs into a weekly log") except EvernoteConnectorException as e: logging.critical("There was an error with the EvernoteConnector: " + e.msg) return print("Completed summarising the log")
def summarise_log(): print("Summarising the log") logging.info("Summarising the daily logs into a weekly log") # concatenate all the daily logs for the week # create a new note in weekly logs with that content # The week is Monday 00:00:00 to Sunday 23:59:59 start_time = get_start_of_week(datetime.now()) end_time = get_end_of_week(datetime.now()) try: evernote_client = EvernoteConnector( token=settings.EVERNOTE_AUTH_TOKEN, sandbox=settings.EVERNOTE_SANDBOX_MODE) summary_content = evernote_client.get_concatenated_daily_logs( start_time, end_time) first_day_of_this_week = datetime.now() - timedelta( days=datetime.now().weekday()) summary_title = datetime.strftime(first_day_of_this_week, "W/C %Y-%m-%d") evernote_client.create_summary_log("Summaries", summary_title, summary_content) logging.info("Completed summarising the daily logs into a weekly log") except EvernoteConnectorException as e: logging.critical("There was an error with the EvernoteConnector: " + e.msg) return print("Completed summarising the log")