From 287d9a6c2d202c93d35d8506bdf6616b357b0598 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Mon, 24 Jun 2024 16:14:16 +0200 Subject: [PATCH] Get the older error if the new one does not exsist Fixes: #2 --- scripts/knotctl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/knotctl b/scripts/knotctl index 5a99bc1..000aaad 100755 --- a/scripts/knotctl +++ b/scripts/knotctl @@ -14,9 +14,12 @@ from urllib.parse import urlparse import argcomplete import requests import yaml -from requests.exceptions import JSONDecodeError as RequestsJSONDecodeError from requests.models import HTTPBasicAuth from simplejson.errors import JSONDecodeError as SimplejsonJSONDecodeError +try: + from requests.exceptions import JSONDecodeError as RequestsJSONDecodeError +except ImportError: + from requests.exceptions import InvalidJSONError as RequestsJSONDecodeError # Helper functions