Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:2.7-alpine
FROM python:3.6.8-alpine
MAINTAINER "Matjaž Finžgar" <matjaz@finzgar.net>

WORKDIR /app
Expand Down
10 changes: 8 additions & 2 deletions webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import logging
from sys import stderr, hexversion
logging.basicConfig(stream=stderr)

import hmac
from hashlib import sha1
Expand All @@ -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__)

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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')