Browse Source

A decoder error is a ValueError allows us to catch all decode errors from requests without force install simplejson

hotfix/merge
Shon T. Urbas 7 years ago
committed by Illes Solt
parent
commit
e8e4f52a16
  1. 3
      keycloak/exceptions.py

3
keycloak/exceptions.py

@ -22,7 +22,6 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import requests import requests
from simplejson import JSONDecodeError
class KeycloakError(Exception): class KeycloakError(Exception):
@ -82,7 +81,7 @@ def raise_error_from_response(response, error, expected_code=200, skip_exists=Fa
try: try:
return response.json() return response.json()
except JSONDecodeError as e:
except ValueError:
return response.content return response.content
if skip_exists and response.status_code == 409: if skip_exists and response.status_code == 409:

Loading…
Cancel
Save