Comments (4)
Here is the fix
--- a/webhooks.py
+++ b/webhooks.py
@@ -79,7 +79,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:
from python-github-webhooks.
confirmed here too.
from python-github-webhooks.
The same here
from python-github-webhooks.
I was still getting below error (FreeBSD)
File "webhooks.py", line 87, in index
mac = hmac.new(str(secret), msg=request.data, digestmod=sha1)
File "/usr/local/lib/python3.7/hmac.py", line 153, in new
return HMAC(key, msg, digestmod)
File "/usr/local/lib/python3.7/hmac.py", line 49, in __init__
raise TypeError("key: expected bytes or bytearray, but got %r" % type(key).__name__)
TypeError: key: expected bytes or bytearray, but got 'str'
Go it to work with
mac = hmac.new(secret.encode('utf-8'), msg=request.data, digestmod=sha1)
from python-github-webhooks.
Related Issues (9)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-github-webhooks.