Skip to content

Commit

Permalink
Use bytes in hashlib function to fix Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigc committed Jan 19, 2017
1 parent 78e08dd commit 96f291a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion master/buildbot/test/unit/test_www_hooks_github.py
Expand Up @@ -26,6 +26,7 @@

from buildbot.test.fake.web import FakeRequest
from buildbot.test.fake.web import fakeMasterForHooks
from buildbot.util import unicode2bytes
from buildbot.www.change_hook import ChangeHookResource
from buildbot.www.hooks.github import _HEADER_CT
from buildbot.www.hooks.github import _HEADER_EVENT
Expand Down Expand Up @@ -293,7 +294,9 @@ def _prepare_request(event, payload, _secret=None, headers=None):
request.received_headers[_HEADER_CT] = _CT_JSON

if _secret is not None:
signature = hmac.new(_secret, msg=payload, digestmod=sha1)
signature = hmac.new(unicode2bytes(_secret),
msg=unicode2bytes(payload),
digestmod=sha1)
request.received_headers[_HEADER_SIGNATURE] = \
'sha1=%s' % (signature.hexdigest(),)
else:
Expand Down

0 comments on commit 96f291a

Please sign in to comment.