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 diff --git a/webhooks.py b/webhooks.py index 082c236..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__) @@ -82,7 +83,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: @@ -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')