Improve logging.

This commit is contained in:
Alexandr
2019-05-17 14:21:38 +03:00
parent a6d7903c57
commit a80b915d10
4 changed files with 9 additions and 4 deletions

View File

@ -30,6 +30,7 @@ class RequestHandler(SimpleHTTPRequestHandler):
length = self.headers.get('content-length')
post_body = self.rfile.read(int(length))
print(post_body)
msg = json.loads(post_body.decode("utf-8"))
self.worker.handleUpdate(msg)
@ -56,6 +57,8 @@ class WebHook:
self.httpd.serve_forever()
except KeyboardInterrupt:
pass
except Exception as e:
print("ERROR: %s" % e)
finally:
# Clean-up server (close socket, etc.)
self.httpd.server_close()