Pythonの組み込みHTTPサーバーを使用して、いくつかの単純な変数を出力しようとしています
class WebServer:
def __init__(self):
from BaseHTTPServer import HTTPServer
import urlparse
server = HTTPServer(('', 8080), self.do_GET)
server.serve_forever()
def do_GET(self):
parsed_path = urlparse.urlparse(self.path)
message_parts = [
'CLIENT VALUES:',
'client_address=%s (%s)' % (self.client_address, self.address_string()),
'command=%s' % self.command,
'path=%s' % self.path,
'real path=%s' % parsed_path.path,
'query=%s' % parsed_path.query,
'request_version=%s' % self.request_version,
'',
'SERVER VALUES:',
'server_version=%s' % self.server_version,
'sys_version=%s' % self.sys_version,
'protocol_version=%s' % self.protocol_version,
'',
'HEADERS RECEIVED:',
]
for name, value in sorted(self.headers.items()):
message_parts.append('%s=%s' % (name, value.rstrip()))
message_parts.append('')
message = '\r\n'.join(message_parts)
self.send_response(200)
self.end_headers()
self.wfile.write(message)
return
しかし、私はこのエラーが発生したようです:
Exception happened during processing of request from ('10.0.1.3', 52251)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
TypeError: do_GET() takes exactly 1 argument (4 given)
----------------------------------------
def do_GET(self): 自分自身以外のものを受け取っているようですが、何が欠けていますか?