from http.server import BaseHTTPRequestHandler, HTTPServer PATH = "/.well-known/appspecific/com.tesla.3p.public-key.pem" BODY = b"""-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEwzRZ0/qkjniIsolp8NNhDl6dBm+\nSNr+ZtdFjx1FlQLr8sPuH0Up0iNbneUvHjGxjGq+G0eqgCwIuX4jaeBEpQ==\n-----END PUBLIC KEY-----\n""" class H(BaseHTTPRequestHandler): def do_GET(self): if self.path == PATH: self.send_response(200) self.send_header("Content-Type", "text/plain; charset=utf-8") self.send_header("Content-Length", str(len(BODY))) self.end_headers() self.wfile.write(BODY) else: self.send_response(404) self.end_headers() def log_message(self, fmt, *args): pass HTTPServer(("0.0.0.0", 18123), H).serve_forever()