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