From 1c42ee84f650dbf76b95cdf32a38a5da5384d68e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 06 2018 13:48:34 +0000 Subject: Fix generating the hmac with both py2 and py3 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/lib/tasks_services.py b/pagure/lib/tasks_services.py index 37a700c..c9e6b06 100644 --- a/pagure/lib/tasks_services.py +++ b/pagure/lib/tasks_services.py @@ -80,9 +80,11 @@ def call_web_hooks(project, topic, msg, urls): content = json.dumps(msg) hashhex = hmac.new( - "%s" % project.hook_token, content, hashlib.sha1).hexdigest() + project.hook_token.encode('utf-8'), + content, hashlib.sha1).hexdigest() hashhex256 = hmac.new( - "%s" % project.hook_token, content, hashlib.sha256).hexdigest() + project.hook_token.encode('utf-8'), + content, hashlib.sha256).hexdigest() headers = { 'X-Pagure': pagure_config['APP_URL'], 'X-Pagure-project': project.fullname,