def inform(best_price_info, config): text = InformText.get_text(config['informer_text_template'], best_price_info, config) subject = InformText.get_text(config['informer_subject_template'], best_price_info, config) # Check if sms text was not changed - not send new message if text == config['last_message'] or \ best_price_info['price'] == config['last_price']: return server_config = Configuration.get_category('SMTP_SERVER'); SimpleEmailSender.send({'to_email': config['informer_email'], 'to_name': config['informer_email_name'], 'server': server_config['server'], 'port': server_config['port'], 'username': server_config['username'], 'password': server_config['password'], 'from_email': server_config['email'], 'from_name': server_config['name'], 'text': text, 'subject': subject}) # Set new last information parameters in config config['last_message'] = text config['last_price'] = str(best_price_info['price'])
def inform(best_price_info, config): api_id = config['informer_api_id'] to = config['informer_phone_number'] text = InformText.get_text(config['informer_text_template'], best_price_info, config) # Check if sms text was not changed - not send new message if text == config['last_message'] or \ best_price_info['price'] == config['last_price']: return # Generation of request url for sending the sms get_parameters = urllib.parse.urlencode({'api_id': api_id, 'to': to, 'text': text}) url = 'http://sms.ru/sms/send?' + get_parameters # Send requests.post(url) # Set new last information parameters in config config['last_message'] = text config['last_price'] = str(best_price_info['price'])
def inform(best_price_info, config): text = InformText.get_text(config['informer_text_template'], best_price_info, config) print(text) # Set new last information parameters in config config['last_price'] = str(best_price_info['price'])
def inform(best_price_info, config): command = InformText.get_text(config['informer_command_template'], best_price_info, config) # Check if sms text was not changed - not send new message if command == config['last_message'] or \ best_price_info['price'] == config['last_price']: return os.system(command); # Set new last information parameters in config config['last_message'] = command config['last_price'] = str(best_price_info['price'])