Skip to content

Commit 5362045

Browse files
committed
fixed bug due to bytes encoding error for github secret
1 parent 48874a1 commit 5362045

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="webhooks_git_automata",
8-
version="0.0.2",
8+
version="0.0.3",
99
author="Alex Barcelo",
1010
author_email="[email protected]",
1111
description="Webhook receiver for Git deployments",

webhooks_git_automata/providers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ def webhook_github(secret):
4141
if not secret:
4242
raise SystemError("No `secret` configured, refusing to accept petition")
4343

44+
try:
45+
# We need a bytes object, if secret is a str then we should encode it
46+
secret = secret.encode("ascii")
47+
except AttributeError:
48+
# Hopefully it failed because it already is a bytes object
49+
pass
50+
4451
try:
4552
digest = hmac.digest(secret, request.get_data(), "sha1")
4653
except AttributeError: # Python < 3.7, using older & slower approach

0 commit comments

Comments
 (0)