Cosmetic fix-up

This commit is contained in:
Scott Wallace 2020-11-11 10:36:02 +00:00
parent 076207118b
commit e47989d80a

View file

@ -23,26 +23,30 @@ from .messaging import MessageHandler
webapp = Flask(__name__) webapp = Flask(__name__)
# FIXME: * Find a better way to deny FlaskView methods without using a `_`
# prefix or raising a NotFound exception
class Alertify(FlaskView): class Alertify(FlaskView):
""" """
Main alertify class Main Alertify class
""" """
route_base = '/' route_base = '/'
trailing_slash = False trailing_slash = False
def __init__(self): def __init__(self):
# Instantiate with defaults
self.configure() self.configure()
def configure(self, configfile=None): def configure(self, configfile=None):
""" """
Configure the object from a configfile Configure from a configfile
""" """
try: # Deny via HTTP
_ = request.args if request:
raise werkzeug.exceptions.NotFound raise werkzeug.exceptions.NotFound
except RuntimeError:
self.config = Config(configfile) self.config = Config(configfile)
self.gotify = Gotify( self.gotify = Gotify(
self.config.gotify_server, self.config.gotify_server,
@ -60,10 +64,10 @@ class Alertify(FlaskView):
""" """
Listen on port and run webserver Listen on port and run webserver
""" """
try: # Deny via HTTP
_ = request.args if request:
raise werkzeug.exceptions.NotFound raise werkzeug.exceptions.NotFound
except RuntimeError:
webapp.run(host='0.0.0.0', port=self.config.listen_port) webapp.run(host='0.0.0.0', port=self.config.listen_port)
@route('/alert', methods=['POST']) @route('/alert', methods=['POST'])