Improve logging for http client
This commit is contained in:
parent
f2e03e878e
commit
d8db463423
2 changed files with 8 additions and 6 deletions
|
@ -62,6 +62,7 @@ class MyHandler(BaseHTTPRequestHandler):
|
||||||
self.answer_request(1)
|
self.answer_request(1)
|
||||||
|
|
||||||
def do_OPTIONS(self):
|
def do_OPTIONS(self):
|
||||||
|
LOG.debug("Serving OPTIONS request...")
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header('Content-Length', '0')
|
self.send_header('Content-Length', '0')
|
||||||
self.send_header('X-Plex-Client-Identifier', v.PKC_MACHINE_IDENTIFIER)
|
self.send_header('X-Plex-Client-Identifier', v.PKC_MACHINE_IDENTIFIER)
|
||||||
|
@ -92,8 +93,8 @@ class MyHandler(BaseHTTPRequestHandler):
|
||||||
self.send_header('Connection', "close")
|
self.send_header('Connection', "close")
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write(body.encode('utf-8'))
|
self.wfile.write(body.encode('utf-8'))
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
pass
|
LOG.debug('Exception encountered while responding: %s', exc)
|
||||||
|
|
||||||
def answer_request(self, send_data):
|
def answer_request(self, send_data):
|
||||||
self.serverlist = self.server.client.getServerList()
|
self.serverlist = self.server.client.getServerList()
|
||||||
|
@ -106,10 +107,11 @@ class MyHandler(BaseHTTPRequestHandler):
|
||||||
params = {}
|
params = {}
|
||||||
for key in paramarrays:
|
for key in paramarrays:
|
||||||
params[key] = paramarrays[key][0]
|
params[key] = paramarrays[key][0]
|
||||||
LOG.debug("remote request_path: %s", request_path)
|
LOG.debug("remote request_path: %s, received from %s with headers: %s",
|
||||||
|
request_path, self.client_address, self.headers.items())
|
||||||
LOG.debug("params received from remote: %s", params)
|
LOG.debug("params received from remote: %s", params)
|
||||||
sub_mgr.update_command_id(self.headers.get(
|
sub_mgr.update_command_id(self.headers.get(
|
||||||
'X-Plex-Client-Identifier', self.client_address[0]),
|
'X-Plex-Client-Identifier', self.client_address[0]),
|
||||||
params.get('commandID'))
|
params.get('commandID'))
|
||||||
if request_path == "version":
|
if request_path == "version":
|
||||||
self.response(
|
self.response(
|
||||||
|
|
|
@ -97,8 +97,8 @@ class plexgdm(object):
|
||||||
% (self.client_header, self.client_data),
|
% (self.client_header, self.client_data),
|
||||||
self.client_register_group)
|
self.client_register_group)
|
||||||
log.debug('(Re-)registering PKC Plex Companion successful')
|
log.debug('(Re-)registering PKC Plex Companion successful')
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
log.error("Unable to send registration message")
|
log.error("Unable to send registration message. Error: %s", exc)
|
||||||
|
|
||||||
def client_update(self):
|
def client_update(self):
|
||||||
self.update_sock = socket.socket(socket.AF_INET,
|
self.update_sock = socket.socket(socket.AF_INET,
|
||||||
|
|
Loading…
Reference in a new issue