code: def do_GET(self):
      assert self.path[0] == "/"
      target = unquote(self.path[1:])
  
      if target == "":
          self.send_response(302)
          self.send_header("Location", "?" + args.initial_target)
          self.end_headers()
          return
  
      if not target.startswith("?"):
          self.send_response(404)
          self.end_headers()
          return
      target = target[1:]
  
      ninja_output, ninja_error, exit_code = ninja_dump(target)
      if exit_code == 0:
          page_body = generate_html(parse(ninja_output.strip()))
      else:
          # Relay ninja's error message.
          page_body = "<h1><tt>%s</tt></h1>" % html_escape(ninja_error)
  
      self.send_response(200)
      self.end_headers()
      self.wfile.write(create_page(page_body).encode("utf-8"))
  
imports: import argparse
  import os
  import socket
  import subprocess
  import sys
  import webbrowser
  from collections import namedtuple
label_desc: Use image node_id 1 for calling the RequestHandler obj's underlying member method code with example usage: obj.do_GET() without return types