INNER CODE UNIT · Python
log_message
cipi-sh/cipi · lib/cipi-crowdsec-rescue.py:129
def log_message(self, fmt: str, *args) -> None:
# Do not log the request line — it contains the token.
sys.stderr.write("rescue peer=%s\n" % (_peer_ip(self),))
def _send(self, code: int, body: str) -> None:
data = body.encode("ascii", "replace")
self.send_response(code)
self.send_header("Content-Type", "text/plain; charset=us-ascii")
self.send_header("Content-Length", str(len(data)))
self.send_header("Cache-Control", "no-store")
self.send_header("Connection", "close")
self.end_headers()
self.wfile.write(data)
def do_POST(self) -> None:
self._send(405, "GET only\n")
def do_PUT(self) -> None: