mirror of https://github.com/MISP/MISP
chg: [tools:webhook-listener] Slightly clever printing
parent
c26f0e5ea1
commit
70aebb2f0b
|
@ -24,8 +24,13 @@ class MyServer(BaseHTTPRequestHandler):
|
||||||
self.send_header("Content-type", "text/html")
|
self.send_header("Content-type", "text/html")
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.data_string = self.rfile.read(int(self.headers['Content-Length']))
|
self.data_string = self.rfile.read(int(self.headers['Content-Length']))
|
||||||
data = json.loads(self.data_string)
|
self.data_string = self.data_string.decode('utf8')
|
||||||
pprint(data)
|
try:
|
||||||
|
data = json.loads(self.data_string)
|
||||||
|
pprint(data)
|
||||||
|
except json.decoder.JSONDecodeError as e:
|
||||||
|
data = self.data_string
|
||||||
|
print(data)
|
||||||
print()
|
print()
|
||||||
self.wfile.write(bytes("<html><head><title>https://pythonbasics.org</title></head>", "utf-8"))
|
self.wfile.write(bytes("<html><head><title>https://pythonbasics.org</title></head>", "utf-8"))
|
||||||
self.wfile.write(bytes("<p>Request: %s</p>" % self.path, "utf-8"))
|
self.wfile.write(bytes("<p>Request: %s</p>" % self.path, "utf-8"))
|
||||||
|
|
Loading…
Reference in New Issue