def _check_resp(resp):
if resp.status_code == requests.codes.ok:
info = (resp.text[:1000] + '..') if len(resp.text) > 1000 else resp.text
xbmc.log("[%s] Reply from SD: %s - %s" %
(ADDON.getAddonInfo('id'), resp.status_code, info), xbmc.LOGDEBUG)
return True
else:
message = ''
try:
info = resp.json()
if 'message' in info:
message = info['message']
except ValueError:
message = resp.text
xbmcgui.Dialog().ok(ADDON.getAddonInfo('name'), 'SchedulesDirect server reply:', message)
xbmc.log("[%s] SD-Server response: %s - %s" %
(ADDON.getAddonInfo('id'), resp.status_code, resp.text), xbmc.LOGDEBUG)
return False
评论列表
文章目录