Skip to content

Commit 59e30f2

Browse files
author
Shane DeWael
authored
Merge pull request #44 from shanedewael/request-signing-update
Update request signing to work for any content type
2 parents 6a269ed + a767ad5 commit 59e30f2

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ language: python
44
python:
55
- "2.7.6"
66
- "2.7"
7-
- "3.3"
87
- "3.4"
98
- "3.5"
109
- "3.6"

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ coveralls==1.1
22
ipdb==0.9.3
33
ipython==4.1.2
44
pdbpp==0.8.3
5-
pytest>=3.2.0
5+
pytest>=3.2.0,<4.0.0
66
pytest-flask==0.10.0
77
pytest-mock>=1.6.3
88
pytest-cov==2.5.1

slackeventsapi/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def verify_signature(self, timestamp, signature):
5353
# It's recommended to use Python 2.7.7+
5454
# noqa See https://docs.python.org/2/whatsnew/2.7.html#pep-466-network-security-enhancements-for-python-2-7
5555
if hasattr(hmac, "compare_digest"):
56-
req = str.encode('v0:' + str(timestamp) + ':') + request.data
56+
req = str.encode('v0:' + str(timestamp) + ':') + request.get_data()
5757
request_hash = 'v0=' + hmac.new(
5858
str.encode(self.signing_secret),
5959
req, hashlib.sha256
@@ -65,7 +65,7 @@ def verify_signature(self, timestamp, signature):
6565
return hmac.compare_digest(request_hash, signature)
6666
else:
6767
# So, we'll compare the signatures explicitly
68-
req = str.encode('v0:' + str(timestamp) + ':') + request.data
68+
req = str.encode('v0:' + str(timestamp) + ':') + request.get_data()
6969
request_hash = 'v0=' + hmac.new(
7070
str.encode(self.signing_secret),
7171
req, hashlib.sha256

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
; for quality analysis, use `tox -e flake8` or just `flake8 slackeventsapi`
55
; to build the docs, use `tox -e docs`
66
envlist=
7-
py{276,27,33,34,35,36},
7+
py{276,27,34,35,36},
88
flake8,
99
docs
1010

0 commit comments

Comments
 (0)