mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
If we fail to parse a response, log the uri
and the original response
This commit is contained in:
parent
f7bc208fd1
commit
b1e27d9bc2
1 changed files with 21 additions and 13 deletions
|
@ -1,3 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# This file is part of PlexPy.
|
||||
#
|
||||
# PlexPy is free software: you can redistribute it and/or modify
|
||||
|
@ -14,12 +17,11 @@
|
|||
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from plexpy import logger, helpers
|
||||
|
||||
from httplib import HTTPSConnection
|
||||
from httplib import HTTPConnection
|
||||
|
||||
import ssl
|
||||
|
||||
|
||||
class HTTPHandler(object):
|
||||
"""
|
||||
Retrieve data from Plex Server
|
||||
|
@ -88,6 +90,7 @@ class HTTPHandler(object):
|
|||
return None
|
||||
|
||||
if request_status == 200:
|
||||
try:
|
||||
if output_format == 'dict':
|
||||
output = helpers.convert_xml_to_dict(request_content)
|
||||
elif output_format == 'json':
|
||||
|
@ -101,6 +104,11 @@ class HTTPHandler(object):
|
|||
return output, content_type
|
||||
|
||||
return output
|
||||
|
||||
except Exception as e:
|
||||
logger.warn(u"Failed format response from uri %s to %s error %s" % (uri, output_format, e))
|
||||
return None
|
||||
|
||||
else:
|
||||
logger.warn(u"Failed to access uri endpoint %s. Status code %r" % (uri, request_status))
|
||||
return None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue