|
@ -16,7 +16,6 @@ |
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
|
|
|
|
|
|
import requests |
|
|
import requests |
|
|
from json import JSONDecodeError |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class KeycloakError(Exception): |
|
|
class KeycloakError(Exception): |
|
@ -73,10 +72,9 @@ def raise_error_from_response(response, error, expected_code=200): |
|
|
if expected_code == response.status_code: |
|
|
if expected_code == response.status_code: |
|
|
if expected_code == requests.codes.no_content: |
|
|
if expected_code == requests.codes.no_content: |
|
|
return {} |
|
|
return {} |
|
|
|
|
|
|
|
|
try: |
|
|
try: |
|
|
return response.json() |
|
|
return response.json() |
|
|
except JSONDecodeError as e: |
|
|
|
|
|
|
|
|
except ValueError: |
|
|
return response.content |
|
|
return response.content |
|
|
|
|
|
|
|
|
try: |
|
|
try: |
|
|