From 6e166c5715fbf73f0b248421152f507a4edfeae5 Mon Sep 17 00:00:00 2001 From: Kajigga Date: Wed, 27 Feb 2019 13:40:58 -0700 Subject: [PATCH 1/3] update webhooks.py to fix sha1 typo --- webhooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webhooks.py b/webhooks.py index 082c236..446d345 100644 --- a/webhooks.py +++ b/webhooks.py @@ -82,7 +82,7 @@ def index(): abort(501) # HMAC requires the key to be bytes, but data is string - mac = hmac.new(str(secret), msg=request.data, digestmod='sha1') + mac = hmac.new(str(secret), msg=request.data, digestmod=sha1) # Python prior to 2.7.7 does not have hmac.compare_digest if hexversion >= 0x020707F0: From a91868c52ebb03c5165c1b8ab5285b8ff002cf1f Mon Sep 17 00:00:00 2001 From: Kajigga Date: Wed, 27 Feb 2019 13:44:40 -0700 Subject: [PATCH 2/3] update to python3.6 alpine --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f94f88e..93e9e3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:2.7-alpine +FROM python:3.6.8-alpine MAINTAINER "Matjaž Finžgar" WORKDIR /app From 23b8b37526cffa4a04c37bd3bd7e17b4f0f3d87f Mon Sep 17 00:00:00 2001 From: Kajigga Dev Date: Wed, 27 Feb 2019 15:28:56 -0700 Subject: [PATCH 3/3] add status for verifying app is functioning --- webhooks.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webhooks.py b/webhooks.py index 446d345..1068841 100644 --- a/webhooks.py +++ b/webhooks.py @@ -17,7 +17,6 @@ import logging from sys import stderr, hexversion -logging.basicConfig(stream=stderr) import hmac from hashlib import sha1 @@ -30,7 +29,9 @@ import requests from ipaddress import ip_address, ip_network from flask import Flask, request, abort +from flask import jsonify +logging.basicConfig(stream=stderr) application = Flask(__name__) @@ -202,5 +203,10 @@ def index(): return output +@application.route('/status', methods=['GET']) +def status(): + return jsonify({'status': 'ok'}) + + if __name__ == '__main__': application.run(debug=True, host='0.0.0.0')