<s> import logging <EOL> from . observer import Observer <EOL> import config <EOL> import smtplib <EOL> def send_email ( subject , message ) : <EOL> _to = config . smtp_to <EOL> _from = config . smtp_from <EOL> mime_message = """<STR_LIT>""" % locals ( ) <EOL> try : <EOL> smtpObj = smtplib . SMTP ( config . smtp_host ) <EOL> smtpObj . sendmail ( _from , [ _to ] , mime_message ) <EOL> except smtplib . SMTPException : <EOL> logging . warn ( "<STR_LIT>" ) <EOL> class Emailer ( Observer ) : <EOL> def opportunity ( self , profit , volume , buyprice , kask , sellprice , kbid , perc , <EOL> weighted_buyprice , weighted_sellprice ) : <EOL> if profit > config . profit_thresh and perc > config . perc_thresh : <EOL> message = """<STR_LIT>""" % ( profit , volume , buyprice , kask , sellprice , kbid , perc ) <EOL> send_email ( "<STR_LIT>" , message ) </s>
