From e8e4f52a16abfc51496ddd3b237597b9e106c19a Mon Sep 17 00:00:00 2001 From: "Shon T. Urbas" Date: Wed, 6 Dec 2017 14:25:16 -0500 Subject: [PATCH 1/2] A decoder error is a ValueError allows us to catch all decode errors from requests without force install simplejson --- keycloak/exceptions.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/keycloak/exceptions.py b/keycloak/exceptions.py index aeef7c2..3b0b147 100644 --- a/keycloak/exceptions.py +++ b/keycloak/exceptions.py @@ -22,7 +22,6 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import requests -from simplejson import JSONDecodeError class KeycloakError(Exception): @@ -82,7 +81,7 @@ def raise_error_from_response(response, error, expected_code=200, skip_exists=Fa try: return response.json() - except JSONDecodeError as e: + except ValueError: return response.content if skip_exists and response.status_code == 409: From 18ab07b663a3bccf08635e86cbb20b322bb44d65 Mon Sep 17 00:00:00 2001 From: Illes Solt Date: Wed, 22 Aug 2018 17:51:25 +0200 Subject: [PATCH 2/2] Remove unused dependencies from requirements.txt/setup.py --- docs/source/index.rst | 1 - requirements.txt | 1 - setup.py | 3 ++- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index b34d077..7ec6f2d 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -43,7 +43,6 @@ python-keycloak depends on: * Python 3 * `requests `_ * `python-jose `_ -* `simplejson `_ Tests Dependencies ------------------ diff --git a/requirements.txt b/requirements.txt index f03af1b..70d3ca7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ requests>=2.18.4 httmock>=1.2.5 python-jose>=1.4.0 -simplejson diff --git a/setup.py b/setup.py index 01ba275..04f95c6 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,8 @@ setup( long_description=long_description, long_description_content_type="text/markdown", packages=['keycloak', 'keycloak.authorization', 'keycloak.tests'], - install_requires=['requests==2.18.4', 'httmock==1.2.5', 'python-jose==1.4.0', 'simplejson'], + install_requires=['requests==2.18.4', 'python-jose==1.4.0'], + tests_require=['httmock==1.2.5'], classifiers=[ 'Programming Language :: Python :: 3', 'License :: OSI Approved :: MIT License',