Error catching in api requests
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user