Skip to content

Run with Python 3 only #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
dist: xenial
language: python
python:
- "2.7"
- "3.6"
- "3.7"
- "pypy"
- "pypy3"
install:
- pip install tox-travis
Expand Down
2 changes: 1 addition & 1 deletion github_webhook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:license: Apache License, Version 2.0
"""

from github_webhook.webhook import Webhook # noqa
from github_webhook.webhook import Webhook

# -----------------------------------------------------------------------------
# Copyright 2015 Bloomberg Finance L.P.
Expand Down
7 changes: 3 additions & 4 deletions github_webhook/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import hmac
import logging
import json
import six
from flask import abort, request


Expand Down Expand Up @@ -35,7 +34,7 @@ def secret(self):

@secret.setter
def secret(self, secret):
if secret is not None and not isinstance(secret, six.binary_type):
if secret is not None and not isinstance(secret, bytes):
secret = secret.encode("utf-8")
self._secret = secret

Expand Down Expand Up @@ -65,8 +64,8 @@ def _postreceive(self):

if digest is not None:
sig_parts = _get_header("X-Hub-Signature").split("=", 1)
if not isinstance(digest, six.text_type):
digest = six.text_type(digest)
if not isinstance(digest, str):
digest = str(digest)

if len(sig_parts) < 2 or sig_parts[0] != "sha1" or not hmac.compare_digest(sig_parts[1], digest):
abort(400, "Invalid signature")
Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
author_email="[email protected], [email protected], [email protected], [email protected]",
license="Apache 2.0",
packages=["github_webhook"],
install_requires=["flask", "six"],
tests_require=["mock", "pytest"],
python_requires=">=3.6",
install_requires=["flask>=1.0.2"],
tests_require=["pytest"],
classifiers=[
"Development Status :: 4 - Beta",
"Framework :: Flask",
Expand All @@ -21,9 +22,7 @@
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Version Control",
],
test_suite="nose.collector",
)
6 changes: 2 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
[tox]
envlist = py27,py36,py37,pypy,pypy3,flake8
envlist = py36,py37,pypy3,flake8

[testenv]
deps =
pytest
pytest-cov
flask
six
py{27,py}: mock
commands = pytest -vl --cov=github_webhook --cov-report term-missing --cov-fail-under 100
commands = pytest -vl --cov=github_webhook --cov-report term-missing --cov-fail-under 98

[testenv:flake8]
deps = flake8
Expand Down