示例#1
0
    def do_GET(s):
      """Respond to a GET request."""
      print 'Got a request, ringing now'
      ReleSounds.ring()
      s.send_response(200)
      s.send_header("Content-type", "text/html")
      s.end_headers()
      s.wfile.write("<html><head><title>It worked.</title></head>")
      s.wfile.write("<p>You accessed path: %s</p>" % s.path)
      s.wfile.write("</body></html>")


      def main():
        print "Setting up"
        ReleSounds.ready()
        server_class = BaseHTTPServer.HTTPServer
        httpd = server_class(('', PORT_NUMBER), MyHandler)
        try:
          httpd.serve_forever()
        except KeyboardInterrupt:
          pass
          httpd.server_close()

          if __name__ == '__main__':
            main()
示例#2
0
      def main():
        print "Setting up"
        ReleSounds.ready()
        server_class = BaseHTTPServer.HTTPServer
        httpd = server_class(('', PORT_NUMBER), MyHandler)
        try:
          httpd.serve_forever()
        except KeyboardInterrupt:
          pass
          httpd.server_close()

          if __name__ == '__main__':
            main()