title: http.server not serving pages as per example from python.org
body: <p>I'm trying to start a simple dir server on a local network But I am getting this error </p>
  
  <blockquote>
    <p>Error response</p>
    
    <p>Error code: 501</p>
    
    <p>Message: Unsupported method ('GET').</p>
    
    <p>Error code explanation: HTTPStatus.NOT_IMPLEMENTED - Server does not
    support this operation.</p>
  </blockquote>
  
  <p>This is the example given at <a href="https://docs.python.org/3/library/http.server.html" rel="nofollow noreferrer">https://docs.python.org/3/library/http.server.html</a> If I run it from the command line it works python3 -m http.server. I need to control this server over time so I need to turn it on for a while and turn it off automatically </p>
  
  <pre><code>from http.server import BaseHTTPRequestHandler, HTTPServer
  
  
  
  
  def run(server_class=HTTPServer, handler_class=BaseHTTPRequestHandler):
      server_address = ('0.0.0.0', 8000)
      httpd = server_class(server_address, handler_class)
      httpd.serve_forever()
  </code></pre>