From f7c67d1b5e80366c33b252d9027ddf7688a454c3 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Thu, 1 Oct 2020 15:42:29 +0200 Subject: Fix TypeError "expected bytes or bytearray, but got 'str'" with python3 --- local/handler/GithubHandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local/handler/GithubHandler.py b/local/handler/GithubHandler.py index 99c5931..1d77c33 100644 --- a/local/handler/GithubHandler.py +++ b/local/handler/GithubHandler.py @@ -123,7 +123,7 @@ class GithubHandler(http.server.BaseHTTPRequestHandler): s.wfile.write("This channel requires a secret\n".encode()) return - digest = "sha1=%s" % (hmac.new(secret, payload, hashlib.sha1).hexdigest(),) + digest = "sha1=%s" % (hmac.new(bytes(secret, 'utf-8'), bytes(payload, 'utf-8'), hashlib.sha1).hexdigest()) log.debug("expected digest: %s", digest) provided = s.headers['X-Hub-Signature'] -- cgit v1.2.3