def __init__(self, settings, max_attempts, static_map_key): # Required Parameters self.__webhook_url = require_and_remove_key('webhook_url', settings, "'Discord' type alarms.") self.__max_attempts = max_attempts # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) self.__disable_embed = parse_boolean( settings.pop('disable_embed', "False")) self.__avatar_url = settings.pop('avatar_url', "") self.__map = settings.pop('map', {}) self.__static_map_key = static_map_key # Set Alert Parameters self.__monsters = self.create_alert_settings( settings.pop('monsters', {}), self._defaults['monsters']) self.__stops = self.create_alert_settings(settings.pop('stops', {}), self._defaults['stops']) self.__gyms = self.create_alert_settings(settings.pop('gyms', {}), self._defaults['gyms']) self.__eggs = self.create_alert_settings(settings.pop('eggs', {}), self._defaults['eggs']) self.__raids = self.create_alert_settings(settings.pop('raids', {}), self._defaults['raids']) # Warn user about leftover parameters reject_leftover_parameters(settings, "'Alarm level in Discord alarm.") log.info("Discord Alarm has been created!")
def __init__(self, mgr, settings, max_attempts, static_map_key): self._log = mgr.get_child_logger("alarms") # Required Parameters self.__webhook_url = require_and_remove_key( 'webhook_url', settings, "'Discord' type alarms.") self.__max_attempts = max_attempts # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) self.__disable_embed = parse_boolean( settings.pop('disable_embed', "False")) self.__avatar_url = settings.pop('avatar_url', "") self.__map = settings.pop('map', {}) self.__static_map_key = static_map_key # Set Alert Parameters self.__monsters = self.create_alert_settings( settings.pop('monsters', {}), self._defaults['monsters']) self.__stops = self.create_alert_settings( settings.pop('stops', {}), self._defaults['stops']) self.__gyms = self.create_alert_settings( settings.pop('gyms', {}), self._defaults['gyms']) self.__eggs = self.create_alert_settings( settings.pop('eggs', {}), self._defaults['eggs']) self.__raids = self.create_alert_settings( settings.pop('raids', {}), self._defaults['raids']) self.__weather = self.create_alert_settings( settings.pop('weather', {}), self._defaults['weather']) # Warn user about leftover parameters reject_leftover_parameters(settings, "'Alarm level in Discord alarm.") self._log.info("Discord Alarm has been created!")
def __init__(self, settings): # Required Parameters self.__bot_token = require_and_remove_key('bot_token', settings, "'Telegram' type alarms.") self.__chat_id = require_and_remove_key('chat_id', settings, "'Telegram' type alarms.") self.__client = None # Optional Alarm Parameters self.__venue = parse_boolean(settings.pop('venue', "False")) self.__location = parse_boolean(settings.pop('location', "True")) self.__stickers = parse_boolean(settings.pop('stickers', 'True')) self.__disable_map_notification = parse_boolean( settings.pop('disable_map_notification', "True")) self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) # Optional Alert Parameters self.__pokemon = self.create_alert_settings( settings.pop('pokemon', {}), self._defaults['pokemon']) self.__pokestop = self.create_alert_settings( settings.pop('pokestop', {}), self._defaults['pokestop']) self.__gym = self.create_alert_settings(settings.pop('gym', {}), self._defaults['gym']) self.__egg = self.create_alert_settings(settings.pop('egg', {}), self._defaults['egg']) self.__raid = self.create_alert_settings(settings.pop('raid', {}), self._defaults['raid']) # Warn user about leftover parameters reject_leftover_parameters(settings, "'Alarm level in Telegram alarm.") log.info("Telegram Alarm has been created!")
def __init__(self, mgr, settings): self._log = mgr.get_child_logger("alarms") # Required Parameters self.__page_access_token = require_and_remove_key( 'page_access_token', settings, "'FacebookPage' type alarms.") self.__client = None # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) # Set Alerts self.__monsters = self.create_alert_settings( settings.pop('monsters', {}), self._defaults['monsters']) self.__stops = self.create_alert_settings(settings.pop('stops', {}), self._defaults['stops']) self.__gyms = self.create_alert_settings(settings.pop('gyms', {}), self._defaults['gyms']) self.__eggs = self.create_alert_settings(settings.pop('eggs', {}), self._defaults['eggs']) self.__raids = self.create_alert_settings(settings.pop('raids', {}), self._defaults['raids']) self.__weather = self.create_alert_settings( settings.pop('weather', {}), self._defaults['weather']) # Warn user about leftover parameters reject_leftover_parameters(settings, "Alarm level in FacebookPage alarm.") self._log.info("FacebookPage Alarm has been created!")
def __init__(self, mgr, settings): self._log = mgr.get_child_logger("alarms") # Required Parameters self.__api_key = require_and_remove_key( 'api_key', settings, "'Pushbullet' type alarms.") self.__client = None # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) self.__channel = settings.pop('channel', "True") self.__sender = None # Optional Alert Parameters self.__pokemon = self.create_alert_settings( settings.pop('monsters', {}), self._defaults['monsters']) self.__pokestop = self.create_alert_settings( settings.pop('stops', {}), self._defaults['stops']) self.__gym = self.create_alert_settings( settings.pop('gyms', {}), self._defaults['gyms']) self.__egg = self.create_alert_settings( settings.pop('eggs', {}), self._defaults['eggs']) self.__raid = self.create_alert_settings( settings.pop('raids', {}), self._defaults['raids']) self.__weather = self.create_alert_settings( settings.pop('weather', {}), self._defaults['weather']) # Warn user about leftover parameters reject_leftover_parameters( settings, "Alarm level in Pushbullet alarm.") self._log.info("Pushbullet Alarm has been created!")
def __init__(self, settings): # Required Parameters self.__api_key = require_and_remove_key('api_key', settings, "'Pushbullet' type alarms.") self.__client = None # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) self.__channel = settings.pop('channel', "True") self.__sender = None # Optional Alert Parameters self.__pokemon = self.create_alert_settings( settings.pop('pokemon', {}), self._defaults['pokemon']) self.__pokestop = self.create_alert_settings( settings.pop('pokestop', {}), self._defaults['pokestop']) self.__gym = self.create_alert_settings(settings.pop('gyms', {}), self._defaults['gym']) self.__egg = self.create_alert_settings(settings.pop('egg', {}), self._defaults['egg']) self.__raid = self.create_alert_settings(settings.pop('raid', {}), self._defaults['raid']) # Warn user about leftover parameters reject_leftover_parameters(settings, "Alarm level in Pushbullet alarm.") log.info("Pushbullet Alarm has been created!")
def create_alert_settings(self, settings, default): alert = { 'chat_id': settings.pop('chat_id', self.__chat_id), 'title': settings.pop('title', default['title']), 'body': settings.pop('body', default['body']), 'venue': parse_boolean(settings.pop('venue', self.__venue)), 'location': parse_boolean( settings.pop('location', self.__location)), 'disable_map_notification': parse_boolean( settings.pop('disable_map_notification', self.__disable_map_notification)), 'stickers': parse_boolean(settings.pop( 'stickers', self.__stickers)) } reject_leftover_parameters(settings, "'Alert level in Telegram alarm.") return alert
def __init__(self, settings, static_map_key): # Required Parameters self.__api_key = require_and_remove_key('api_key', settings, "'Slack' type alarms.") self.__default_channel = self.channel_format( require_and_remove_key('channel', settings, "'Slack' type alarms.")) self.__client = None self.__channels = {} # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) self.__map = settings.pop('map', {}) self.__static_map_key = static_map_key # Optional Alert Parameters self.__pokemon = self.create_alert_settings( settings.pop('pokemon', {}), self._defaults['pokemon']) self.__pokestop = self.create_alert_settings( settings.pop('pokestop', {}), self._defaults['pokestop']) self.__gym = self.create_alert_settings(settings.pop('gym', {}), self._defaults['gym']) self.__egg = self.create_alert_settings(settings.pop('egg', {}), self._defaults['egg']) self.__raid = self.create_alert_settings(settings.pop('raid', {}), self._defaults['raid']) # Warn user about leftover parameters reject_leftover_parameters(settings, "'Alarm level in Slack alarm.") log.info("Slack Alarm has been created!")
def __init__(self, settings): # Required Parameters self.__page_access_token = require_and_remove_key( 'page_access_token', settings, "'FacebookPage' type alarms.") self.__client = None # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) # Set Alerts self.__pokemon = self.create_alert_settings( settings.pop('pokemon', {}), self._defaults['pokemon']) self.__pokestop = self.create_alert_settings( settings.pop('pokestop', {}), self._defaults['pokestop']) self.__gym = self.create_alert_settings( settings.pop('gym', {}), self._defaults['gym']) self.__egg = self.create_alert_settings( settings.pop('egg', {}), self._defaults['egg']) self.__raid = self.create_alert_settings( settings.pop('raid', {}), self._defaults['raid']) # Warn user about leftover parameters reject_leftover_parameters( settings, "Alarm level in FacebookPage alarm.") log.info("FacebookPage Alarm has been created!")
def __init__(self, mgr, settings): self._log = mgr.get_child_logger("alarms") # Required Parameters self.__page_access_token = require_and_remove_key( 'page_access_token', settings, "'FacebookPage' type alarms.") self.__client = None # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) # Set Alerts self.__monsters = self.create_alert_settings( settings.pop('monsters', {}), self._defaults['monsters']) self.__stops = self.create_alert_settings( settings.pop('stops', {}), self._defaults['stops']) self.__gyms = self.create_alert_settings( settings.pop('gyms', {}), self._defaults['gyms']) self.__eggs = self.create_alert_settings( settings.pop('eggs', {}), self._defaults['eggs']) self.__raids = self.create_alert_settings( settings.pop('raids', {}), self._defaults['raids']) self.__weather = self.create_alert_settings( settings.pop('weather', {}), self._defaults['weather']) # Warn user about leftover parameters reject_leftover_parameters( settings, "Alarm level in FacebookPage alarm.") self._log.info("FacebookPage Alarm has been created!")
def create_alert_settings(self, settings, default): alert = { 'webhook_url': settings.pop('webhook_url', self.__webhook_url), 'username': settings.pop('username', default['username']), 'avatar_url': settings.pop('avatar_url', default['avatar_url']), 'disable_embed': parse_boolean(settings.pop('disable_embed', self.__disable_embed)), 'content': settings.pop('content', default['content']), 'icon_url': settings.pop('icon_url', default['icon_url']), 'title': settings.pop('title', default['title']), 'url': settings.pop('url', default['url']), 'body': settings.pop('body', default['body']), 'map': get_static_map_url(settings.pop('map', self.__map), self.__static_map_key) } reject_leftover_parameters(settings, "'Alert level in Discord alarm.") return alert
def __init__(self, settings): # Required Parameters self.__token = require_and_remove_key('access_token', settings, "'Twitter' type alarms.") self.__token_key = require_and_remove_key('access_secret', settings, "'Twitter' type alarms.") self.__con_secret = require_and_remove_key('consumer_key', settings, "'Twitter' type alarms.") self.__con_secret_key = require_and_remove_key( 'consumer_secret', settings, "'Twitter' type alarms.") self.__client = None # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) # Optional Alert Parameters self.__pokemon = self.create_alert_settings( settings.pop('monsters', {}), self._defaults['monsters']) self.__pokestop = self.create_alert_settings(settings.pop('stops', {}), self._defaults['stops']) self.__gym = self.create_alert_settings(settings.pop('gyms', {}), self._defaults['gyms']) self.__egg = self.create_alert_settings(settings.pop('eggs', {}), self._defaults['eggs']) self.__raid = self.create_alert_settings(settings.pop('raids', {}), self._defaults['raids']) # Warn user about leftover parameters reject_leftover_parameters(settings, "'Alarm level in Twitter alarm.") log.info("Twitter Alarm has been created!")
def __init__(self, settings): # Required Parameters self.__account_sid = require_and_remove_key('account_sid', settings, "'Twilio' type alarms.") self.__auth_token = require_and_remove_key('auth_token', settings, "'Twilio' type alarms.") self.__from_number = require_and_remove_key('from_number', settings, "'Twilio' type alarms.") self.__to_number = require_and_remove_key('to_number', settings, "'Twilio' type alarms.") self.__client = None # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) # Optional Alert Parameters self.__pokemon = self.set_alert(settings.pop('pokemon', {}), self._defaults['pokemon']) self.__pokestop = self.set_alert(settings.pop('pokestop', {}), self._defaults['pokestop']) self.__gym = self.set_alert(settings.pop('gyms', {}), self._defaults['gym']) self.__egg = self.set_alert(settings.pop('egg', {}), self._defaults['egg']) self.__raid = self.set_alert(settings.pop('raid', {}), self._defaults['raid']) # Warn user about leftover parameters reject_leftover_parameters(settings, "'Alarm level in Twilio alarm.") log.info("Twilio Alarm has been created!")
def create_alert_settings(self, settings, default): alert = { 'webhook_url': settings.pop('webhook_url', self.__webhook_url), 'username': settings.pop('username', default['username']), 'avatar_url': settings.pop('avatar_url', default['avatar_url']), 'disable_embed': parse_boolean( settings.pop('disable_embed', self.__disable_embed)), 'content': settings.pop('content', default['content']), 'icon_url': settings.pop('icon_url', default['icon_url']), 'title': settings.pop('title', default['title']), 'url': settings.pop('url', default['url']), 'body': settings.pop('body', default['body']), 'map': get_static_map_url( settings.pop('map', self.__map), self.__static_map_key) } reject_leftover_parameters(settings, "'Alert level in Discord alarm.") return alert
def __init__(self, mgr, settings, static_map_key): self._log = mgr.get_child_logger("alarms") # Required Parameters self.__api_key = require_and_remove_key('api_key', settings, "'Slack' type alarms.") self.__default_channel = self.channel_format( require_and_remove_key('channel', settings, "'Slack' type alarms.")) self.__client = None self.__channels = {} # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) self.__map = settings.pop('map', {}) self.__static_map_key = static_map_key # Optional Alert Parameters self.__pokemon = self.create_alert_settings( settings.pop('monsters', {}), self._defaults['monsters']) self.__pokestop = self.create_alert_settings(settings.pop('stops', {}), self._defaults['stops']) self.__gym = self.create_alert_settings(settings.pop('gyms', {}), self._defaults['gyms']) self.__egg = self.create_alert_settings(settings.pop('eggs', {}), self._defaults['eggs']) self.__raid = self.create_alert_settings(settings.pop('raids', {}), self._defaults['raids']) self.__weather = self.create_alert_settings( settings.pop('weather', {}), self._defaults['weather']) self.__quests = self.create_alert_settings(settings.pop('quests', {}), self._defaults['quests']) self.__invasions = self.create_alert_settings( settings.pop('invasions', {}), self._defaults['invasions']) # Warn user about leftover parameters reject_leftover_parameters(settings, "'Alarm level in Slack alarm.") self._log.info("Slack Alarm has been created!")
def __init__(self, mgr, settings): self._log = mgr.get_child_logger("alarms") # Required Parameters self.__account_sid = require_and_remove_key( 'account_sid', settings, "'Twilio' type alarms.") self.__auth_token = require_and_remove_key( 'auth_token', settings, "'Twilio' type alarms.") self.__from_number = require_and_remove_key( 'from_number', settings, "'Twilio' type alarms.") self.__to_number = require_and_remove_key( 'to_number', settings, "'Twilio' type alarms.") self.__client = None # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) # Optional Alert Parameters self.__pokemon = self.set_alert( settings.pop('monsters', {}), self._defaults['monsters']) self.__pokestop = self.set_alert( settings.pop('stops', {}), self._defaults['stops']) self.__gym = self.set_alert( settings.pop('gyms', {}), self._defaults['gyms']) self.__egg = self.set_alert( settings.pop('eggs', {}), self._defaults['eggs']) self.__raid = self.set_alert( settings.pop('raids', {}), self._defaults['raids']) self.__weather = self.set_alert( settings.pop('weather', {}), self._defaults['weather']) self.__quest = self.set_alert( settings.pop('quests', {}), self._defaults['quests']) self.__invasion = self.set_alert( settings.pop('invasions', {}), self._defaults['invasions']) # Warn user about leftover parameters reject_leftover_parameters(settings, "'Alarm level in Twilio alarm.") self._log.info("Twilio Alarm has been created!")
def __init__(self, mgr, settings): self._log = mgr.get_child_logger("alarms") # Required Parameters self.__token = require_and_remove_key( 'access_token', settings, "'Twitter' type alarms.") self.__token_key = require_and_remove_key( 'access_secret', settings, "'Twitter' type alarms.") self.__con_secret = require_and_remove_key( 'consumer_key', settings, "'Twitter' type alarms.") self.__con_secret_key = require_and_remove_key( 'consumer_secret', settings, "'Twitter' type alarms.") self.__client = None # Optional Alarm Parameters self.__startup_message = parse_boolean( settings.pop('startup_message', "True")) # Optional Alert Parameters self.__pokemon = self.create_alert_settings( settings.pop('monsters', {}), self._defaults['monsters']) self.__pokestop = self.create_alert_settings( settings.pop('stops', {}), self._defaults['stops']) self.__gym = self.create_alert_settings( settings.pop('gyms', {}), self._defaults['gyms']) self.__egg = self.create_alert_settings( settings.pop('eggs', {}), self._defaults['eggs']) self.__raid = self.create_alert_settings( settings.pop('raids', {}), self._defaults['raids']) self.__weather = self.create_alert_settings( settings.pop('weather', {}), self._defaults['weather']) # Warn user about leftover parameters reject_leftover_parameters(settings, "'Alarm level in Twitter alarm.") self._log.info("Twitter Alarm has been created!")