我们从Python开源项目中,提取了以下17个代码示例,用于说明如何使用http.server.BaseHTTPRequestHandler.__init__()。
def __init__(self, manager, input_port, output_url, input_mapper, output_mapper): """ Initiate a WebhookPlatform object :param manager: imbridge.manager.Manager instance :param input_port: the port that WebhookPlatform listens on :param output_url: the webhook URL which message is sent to :param input_mapper: function(input_string) -> message :param output_mapper: function(message) -> output_string """ super(WebhookPlatform, self).__init__() self._manager = manager self._input_port = input_port self._output_url = output_url self._input_mapper = input_mapper self._output_mapper = output_mapper self._init_done = False self._thread = None
def __init__(self, cmd_queue, commands, config, sessions, *args, **kwargs): """ Constructor. """ # Commands queue. self.cmd_queue = cmd_queue # Commands array in shared memory. self.commands = commands # Sessions array in shared memory. self.sessions = sessions # Configuration instance. self.config = config # HTTP server version. self.server_version = "temboard-agent/0.0.1" # HTTP request method self.http_method = None # HTTP query. self.query = None # HTTP POST content in json format. self.post_json = None # Call HTTP request handler constructor. BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
def __init__(self, route_table: Dict[str, Tuple[str, Any]], config: Dict[str, str], renderer, *args: Any) -> None: """ Create a new request handler. :param route_table: A dict with route information, the key is the route as string and the value is a tuple containing the http verb and the action to be executed when the route is requested. """ self._route_table = route_table self._resolver = RouteResolver(route_table) self._config = config self._renderer = renderer self._static_regex = re.compile('[/\w\-\.\_]+(?P<ext>\.\w{,4})$', re.IGNORECASE | re.DOTALL) BaseHTTPRequestHandler.__init__(self, *args) mimetypes.init()
def __init__(self, cb, *args): self._cb = cb BaseHTTPRequestHandler.__init__(self, *args)
def __init__(self, config, duration, errors, *args, **kwargs): self._config = config self._duration = duration self._errors = errors BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
def __init__(self, *args): self.sinkname = self.__class__.__name__ BaseHTTPRequestHandler.__init__(self, *args)
def __init__(self, *args): self.sinkname = self.__class__.__name__ if(args[0]): self.bot = args[0] self._bot = self.bot # backward-compatibility
def __init__(self, request, client_address, server): BaseHTTPRequestHandler.__init__(self, request, client_address, server)
def __init__(self, server_address, RequestHandlerClass, thread = {}): HTTPServer.__init__(self, server_address, RequestHandlerClass) self.thread = thread
def __init__(self, name=None): Thread.__init__(self, name=name) self.daemon = True self.event = Event() self.degree = 90 self.direction = None self.servo = ServoSG90() self.channel = {'left':0, 'right':1, 'middle':2, 'claw':3} self.name = name self.servo.set_pwm_freq(60) self.servo.set_degree(self.channel[name], 90)
def __init__(self, *args, **kwargs): """ """ BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
def __init__(self, config): super(AgentApi, self).__init__(config) self._enabled = config.fetch('agent', 'enabled', bool) self.host = config.fetch('agent', 'host') self.port = config.fetch('agent', 'port', int)
def __init__(self, config): def handler(*args): AgentApiHandler(config, *args) server = HTTPServer((config.host, config.port), handler) server.serve_forever()
def __init__(self, config, *args): self.sender = config.sender BaseHTTPRequestHandler.__init__(self, *args)
def __init__(s, functionPost, functionGet, argument, * args): s.postProcess = functionPost s.getProcess = functionGet s.processArg = argument BaseHTTPRequestHandler.__init__(s, *args)
def __init__(self, request, client_address, server): # keep pycharm from complaining about those not being define in __init__ # self.session_id = '{ip}:{port}'.format(ip=client_address[0], port= client_address[1]) self.session_id = '{ip}'.format(ip=client_address[0]) if self.session_id not in server.sessions: server.sessions[self.session_id] = {'handler': self} self.rfile = None self.wfile = None self.body = None self.PATHMAPPING = { '/accessories': { 'GET': self._get_accessories }, '/characteristics': { 'GET': self._get_characteristics, 'PUT': self._put_characteristics }, '/identify': { 'POST': self._post_identify }, '/pair-setup': { 'POST': self._post_pair_setup }, '/pair-verify': { 'POST': self._post_pair_verify }, '/pairings': { 'POST': self._post_pairings } } self.protocol_version = 'HTTP/1.1' self.close_connection = False self.timeout_counter = 0 # init super class BaseHTTPRequestHandler.__init__(self, request, client_address, server)
def __init__(self, data): self.data = data