2017-07-19 23 views
-1

を取得してPythonでHTTPサーバを作成しようとしています:私はSimpleHTTPServerを使用して、私のコードはここでエラー

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() 

私はエラー'module' object has no attribute 'SimpleHttpRequestHandler'を取得しています、なぜこのエラーが発生しているの?事前

答えて

0

おかげでそれはHTTPが大文字で、SimpleHTTPRequestHandlerSimpleHttpRequestHandlerではありません。

関連する問題