def so_potential_answer_push_notification(): log.info('so_potential_answer_push_notification') # Collect the results questions = so.process.so_potential_answer_get(minutes=3) log.info('%d questions' % len(questions)) # Send the push notifications for q in questions: pushover().send_notification( token=config.Config().get_conf("pushover", "token"), user=config.Config().get_conf("pushover", "user"), title="SO Question", message=q["title"], url=q["link"]) # Save the result so.process.save_questions(questions)
def so_potential_answer_push_notification(): log.info('so_potential_answer_push_notification') # Collect the results questions = so.process.so_potential_answer_get(minutes = 3) log.info('%d questions' % len(questions)) # Send the push notifications for q in questions: pushover().send_notification( token = config.Config().get_conf("pushover", "token"), user = config.Config().get_conf("pushover", "user"), title = "SO Question", message = q["title"], url = q["link"] ) # Save the result so.process.save_questions(questions)
arg_parser.print_help() quit() # Get the data top_day_growth, top_week_growth, top_month_growth = so.process.get_growth_results( ) # Generate the email msg = bt.template('email', top_day_growth=top_day_growth, top_week_growth=top_week_growth, top_month_growth=top_month_growth) # Send the email or show it if show_report_only: filepath = os.path.join(os.path.expanduser('~'), ".tmpemail.htm") with open(filepath, "w") as f: f.write(msg) import webbrowser webbrowser.open(filepath) else: es.sendmail(to, to, "StackOverflow Stats", msg, login, password) if parsed_args.c == "so_questions": questions = so.process.questions_to_alert() for q in questions: pushover().send_notification(token=parsed_args.token, user=parsed_args.user, title="SO Question", message=q["title"], url=q["link"]) so.process.save_questions(questions)
# Send the email or show it if show_report_only: filepath = os.path.join(os.path.expanduser('~'),".tmpemail.htm") with open(filepath,"w") as f: f.write(msg) import webbrowser webbrowser.open(filepath) else: es.sendmail( to, to, "StackOverflow Stats", msg, login, password ) if parsed_args.c == "so_questions": questions = so.process.questions_to_alert() for q in questions: pushover().send_notification( token = parsed_args.token , user = parsed_args.user, title = "SO Question", message = q["title"], url = q["link"] ) so.process.save_questions(questions)