I would like to define a few variables inside my RequestHandler class that is a subclass of BaseHTTPRequestHandler. These variables then should be accessible from inside my do_Post() function. Normaly I would define those variables inside the __ init__() method but the python docs about the BaseHTTPRequestHandler class
says "Subclasses should not need to override or extend the __ init__() method."
So what would be the most elegant way to achieve this?
from http.server import BaseHTTPRequestHandler, HTTPServer
class RequestHandler(BaseHTTPRequestHandler):
def do_POST(self):
#do some stuff