Cosmetic fix-up
This commit is contained in:
parent
076207118b
commit
e47989d80a
|
@ -23,48 +23,52 @@ 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,
|
||||||
self.config.gotify_port,
|
self.config.gotify_port,
|
||||||
self.config.gotify_key_app,
|
self.config.gotify_key_app,
|
||||||
self.config.gotify_key_client,
|
self.config.gotify_key_client,
|
||||||
)
|
)
|
||||||
self.msg_hndlr = MessageHandler(
|
self.msg_hndlr = MessageHandler(
|
||||||
self.gotify,
|
self.gotify,
|
||||||
self.config.disable_resolved,
|
self.config.disable_resolved,
|
||||||
self.config.delete_onresolve,
|
self.config.delete_onresolve,
|
||||||
)
|
)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
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'])
|
||||||
def alert(self):
|
def alert(self):
|
||||||
|
|
Loading…
Reference in a new issue