def setup_in_process(self):
# Set up signal handlers for graceful exit
gevent.signal(gevent.signal.SIGINT, self.stop)
gevent.signal(gevent.signal.SIGTERM, self.stop)
# Update config
config['TIMEZONE'] = self.__timezone
config['API_KEY'] = self.__google_key
config['UNITS'] = self.__units
config['DEBUG'] = self.__debug
config['ROOT_PATH'] = os.path.abspath("{}/..".format(os.path.dirname(__file__)))
# Hush some new loggers
logging.getLogger('requests').setLevel(logging.WARNING)
logging.getLogger('urllib3').setLevel(logging.WARNING)
if config['DEBUG'] is True:
logging.getLogger().setLevel(logging.DEBUG)
# Conect the alarms and send the start up message
for alarm in self.__alarms:
alarm.connect()
alarm.startup_message()
# Main event handler loop
评论列表
文章目录