Error catching in api requests

This commit is contained in:
mcarlton00
2022-03-07 19:36:29 -05:00
parent 6888cbf7b8
commit eb19d80b97
2 changed files with 6 additions and 1 deletions

View File

@@ -29,7 +29,11 @@ class API:
url = '{}{}'.format(self.server, path)
r = requests.get(url, headers=self.headers)
return r.json()
try:
response_data = r.json()
except:
response_data = {}
return response_data
def post(self, url, payload):
if not self.headers:

View File

@@ -5,6 +5,7 @@ import xbmcgui
import xbmcplugin
import xbmcaddon
from .api import API
from .loghandler import LazyLogger
from .item_functions import get_art
from .utils import load_user_details