def __init__(self, lock, parent=None): super(RobotAction, self).__init__(parent) self.lock, self.mutex = lock, QMutex() self.conf = setting.get_conf_file()
if old_points == 0: points_pattern = re.compile(r'you have <span [^>]*>(\d+)</span> *Points!') old_points = int(points_pattern.findall(i['RFC822'])[0]) extra_points += 5 print "Succeeded :-)" # Sign out of MyPoints print "Sign out of MyPoints" f = opener.open('https://www.mypoints.com/emp/u/logout.do') f.read(); f.close() # Log out of emailbox print "Log out of email box: %s" % account[0] mailbox.logout_emailbox(c) return old_points, extra_points if __name__ == '__main__': import sys conf = setting.get_conf_file() msg = '' for account in conf['accounts']: old, extra = process(account) if old: msg += 'MyPoints account: %s\n' % (account[2]) msg += 'Get %d more points, and you have %d points now :-)\n' % (extra, old + extra) print msg