Beispiel #1
0
def so_bulletin_mail():
    # Collect the results
    questions = so.process.so_bulletin_get()
    if not questions:
        return
    # Create the template
    msg = bt.template('so_bulletin', questions=questions)
    # Send the email
    es.sendmail(frm=config.Config().get_conf("mail", "from_addr"),
                to=config.Config().get_conf("mail", "recipient"),
                subject="Stack Overflow Bulletin",
                message=msg,
                login=config.Config().get_conf("mail", "user-login"),
                password=config.Config().get_conf("mail", "password"))
    # Save the result
    so.process.save_questions(questions)
Beispiel #2
0
def so_growth_stats_mail():
    '''Sends statistics of stack overflow'''
    # Collect results
    top_day_growth, top_week_growth, top_month_growth = so.process.get_growth_results(
    )
    # Create a template
    msg = bt.template('so_stats',
                      top_day_growth=top_day_growth,
                      top_week_growth=top_week_growth,
                      top_month_growth=top_month_growth)
    #Send to email results
    es.sendmail(frm=config.Config().get_conf("mail", "from_addr"),
                to=config.Config().get_conf("mail", "recipient"),
                subject="Stack Overflow Statistics",
                message=msg,
                login=config.Config().get_conf("mail", "user-login"),
                password=config.Config().get_conf("mail", "password"))
Beispiel #3
0
def so_bulletin_mail():
	# Collect the results
	questions = so.process.so_bulletin_get()
	if not questions:
		return
	# Create the template
	msg = bt.template('so_bulletin',questions=questions)
	# Send the email
	es.sendmail(
			frm = config.Config().get_conf("mail", "from_addr"), 
			to = config.Config().get_conf("mail", "recipient"), 
			subject = "Stack Overflow Bulletin", 
			message = msg, 
			login = config.Config().get_conf("mail", "user-login"), 
			password = config.Config().get_conf("mail", "password")
			)
	# Save the result
	so.process.save_questions(questions)
Beispiel #4
0
def so_growth_stats_mail():
	'''Sends statistics of stack overflow'''
	# Collect results
	top_day_growth, top_week_growth, top_month_growth = so.process.get_growth_results()
	# Create a template
	msg = bt.template('so_stats',
		top_day_growth = top_day_growth,
		top_week_growth = top_week_growth,
		top_month_growth = top_month_growth
		)
	#Send to email results
	es.sendmail(
			frm = config.Config().get_conf("mail", "from_addr"), 
			to = config.Config().get_conf("mail", "recipient"), 
			subject = "Stack Overflow Statistics", 
			message = msg, 
			login = config.Config().get_conf("mail", "user-login"), 
			password = config.Config().get_conf("mail", "password")
			)
Beispiel #5
0
            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)
Beispiel #6
0
		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"]
		)