Beispiel #1
0
    def do_GET(s):
        filename = tools._filename(s)

        # Fire off some headers with the content type
        s.send_response(200)
        s.send_header("Content-type", tools._content_type(filename))
        s.end_headers()

        filename = s.cleanup_filename(filename)
        
        if not os.path.exists(filename):
            return
            
        with open(filename, 'rb') as f:
            if filename == "dashboard.html":
                template =  f.read()
                tempdict = {}
                for k,func in SOURCES.items():
                    tempdict[k] = func()
                statichtml = template % tempdict
                s.wfile.write(statichtml)
            else:
                s.wfile.write(f.read())

        logging.info("completed do_GET")
Beispiel #2
0
    def do_GET(s):
        filename = tools._filename(s)

        # Fire off some headers with the content type
        s.send_response(200)
        s.send_header("Content-type", tools._content_type(filename))
        s.end_headers()

        if filename == "":
            filename = "dashboard.html"
        if filename == "favicon.ico":
            return

        with open(filename, 'rb') as f:
            if filename == "dashboard.html":
                template =  f.read()
                tempdict = {}
                for k,func in SOURCES.items():
                    tempdict[k] = func()
                statichtml = template % tempdict
                s.wfile.write(statichtml)
            else:
                s.wfile.write(f.read())
Beispiel #3
0
 def do_HEAD(s):
     s.send_response(200)
     s.send_header("Content-type", tools._content_type(tools._filename(s)))
     s.end_headers()
     logging.info("completed do_HEAD")
Beispiel #4
0
 def do_HEAD(s):
     s.send_response(200)
     s.send_header("Content-type", tools._content_type(tools._filename(s)))
     s.end_headers()