0

Here is my code:

import SocketServer
import SimpleHTTPServer

class HttpRequestHandler(SimpleHTTPServer.SimpleHttpRequestHandler) :

    def do_GET(self) :

            if self.path == '/admin' :
                    print "This page is only for admins"

            else :
                    SimpleHTTPServer.SimpleHttpRequestHandler(self)

addr = (('0.0.0.0',10001))
httpServer = SocketServer.TCPServer(addr,HttpRequestHandler)
httpServer.serve_forever()

I am getting the error 'module' object has no attribute 'SimpleHttpRequestHandler', why is this error occurring?

Thanks in advance

1 Answer 1

2

It is SimpleHTTPRequestHandler not SimpleHttpRequestHandler, the HTTP is uppercase.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.