Python http.server.BaseHTTPRequestHandler 模块,__init__() 实例源码

我们从Python开源项目中,提取了以下17个代码示例,用于说明如何使用http.server.BaseHTTPRequestHandler.__init__()

项目:im-bridge    作者:sjtug    | 项目源码 | 文件源码
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
项目:temboard-agent    作者:dalibo    | 项目源码 | 文件源码
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)
项目:pyterrier    作者:dfurtado    | 项目源码 | 文件源码
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()
项目:im-bridge    作者:sjtug    | 项目源码 | 文件源码
def __init__(self, cb, *args):
        self._cb = cb
        BaseHTTPRequestHandler.__init__(self, *args)
项目:prometheus-pve-exporter    作者:znerol    | 项目源码 | 文件源码
def __init__(self, config, duration, errors, *args, **kwargs):
        self._config = config
        self._duration = duration
        self._errors = errors
        BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
项目:hangoutsbot    作者:das7pad    | 项目源码 | 文件源码
def __init__(self, *args):
        self.sinkname = self.__class__.__name__
        BaseHTTPRequestHandler.__init__(self, *args)
项目:hangoutsbot    作者:das7pad    | 项目源码 | 文件源码
def __init__(self, *args):
        self.sinkname = self.__class__.__name__
        if(args[0]):
            self.bot = args[0]
            self._bot = self.bot # backward-compatibility
项目:chip-mearm    作者:janvdbrink    | 项目源码 | 文件源码
def __init__(self, request, client_address, server):
        BaseHTTPRequestHandler.__init__(self, request, client_address, server)
项目:chip-mearm    作者:janvdbrink    | 项目源码 | 文件源码
def __init__(self, server_address, RequestHandlerClass, thread = {}):
        HTTPServer.__init__(self,  server_address, RequestHandlerClass)
        self.thread = thread
项目:chip-mearm    作者:janvdbrink    | 项目源码 | 文件源码
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)
项目:pman    作者:FNNDSC    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        """
        """
        BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
项目:mamonsu    作者:postgrespro    | 项目源码 | 文件源码
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)
项目:mamonsu    作者:postgrespro    | 项目源码 | 文件源码
def __init__(self, config):
        def handler(*args):
            AgentApiHandler(config, *args)
        server = HTTPServer((config.host, config.port), handler)
        server.serve_forever()
项目:mamonsu    作者:postgrespro    | 项目源码 | 文件源码
def __init__(self, config, *args):
        self.sender = config.sender
        BaseHTTPRequestHandler.__init__(self, *args)
项目:PemPyAPI    作者:plutonij    | 项目源码 | 文件源码
def __init__(s, functionPost, functionGet, argument, * args):
        s.postProcess = functionPost
        s.getProcess = functionGet
        s.processArg = argument
        BaseHTTPRequestHandler.__init__(s, *args)
项目:homekit_python    作者:jlusiardi    | 项目源码 | 文件源码
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)
项目:homekit_python    作者:jlusiardi    | 项目源码 | 文件源码
def __init__(self, data):
            self.data = data