Implement webhook

This commit is contained in:
dadav
2019-10-15 08:54:29 +02:00
parent d45e8c7ba0
commit 5f6cc378f1
2 changed files with 21 additions and 0 deletions

View File

@ -14,6 +14,18 @@ import pwnagotchi.ui.fonts as fonts
# Will be set with the options in config.yml config['main']['plugins'][__name__]
OPTIONS = dict()
# called when <host>:<port>/plugins/<pluginname> is opened
def on_webhook(response, path):
res = "<html><body><a>Hook triggered</a></body></html>"
response.send_response(200)
response.send_header('Content-type', 'text/html')
response.end_headers()
try:
response.wfile.write(bytes(res, "utf-8"))
except Exception as ex:
logging.error(ex)
# called when the plugin is loaded
def on_loaded():
logging.warning("WARNING: plugin %s should be disabled!" % __name__)