本文整理汇总了Python中http.server.BaseHTTPRequestHandler.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python BaseHTTPRequestHandler.__init__方法的具体用法?Python BaseHTTPRequestHandler.__init__怎么用?Python BaseHTTPRequestHandler.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类http.server.BaseHTTPRequestHandler
的用法示例。
在下文中一共展示了BaseHTTPRequestHandler.__init__方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self):
self.hostname = None
self.port = None
#这是请求
self.command = None
self.path = None
self.request_version = None
#这是响应
self.response_version = None
self.status = None
self.reason = None
self._headers = None
self._body = b''
示例2: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, app, sessions, *args, **kwargs):
"""
Constructor.
"""
# Sessions array in shared memory.
self.sessions = sessions
# Application instance.
self.app = app
# HTTP server version.
self.server_version = "temboard-agent/%s" % temboard_version
# 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)
示例3: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, server_address, handler_class, config,
bind_and_activate=True):
# pylint: disable=super-init-not-called, non-parent-init-called
# Init just BaseServer, TCPServer creates a socket.
BaseServer.__init__(self, server_address, handler_class)
if isinstance(server_address, socket.socket):
# It's a bound and activates socket from systemd.
self.socket = server_address
bind_and_activate = False
else:
self.socket = socket.socket(self.address_family,
self.socket_type)
# copied from TCPServer
if bind_and_activate:
try:
self.server_bind()
self.server_activate()
except BaseException:
self.server_close()
raise
if self.socket.family == socket.AF_UNIX:
self.socket_file = self.socket.getsockname()
if 'consumers' not in config:
raise ValueError('Configuration does not provide any consumer')
self.config = config
if 'server_string' in self.config:
self.server_string = self.config['server_string']
self.auditlog = log.auditlog
示例4: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, token, d, *args):
self.d = d
self.token = token
BaseHTTPRequestHandler.__init__(self, *args)
示例5: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, response_str):
self._file = BytesIO(response_str)
示例6: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, *args):
self.sinkname = self.__class__.__name__
BaseHTTPRequestHandler.__init__(self, *args)
示例7: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
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)
示例8: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, cloudpath, *args):
self.storage = Storage(cloudpath)
BaseHTTPRequestHandler.__init__(self, *args)
示例9: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, cutouts, *args):
self.cutouts = cutouts
BaseHTTPRequestHandler.__init__(self, *args)
示例10: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, request, address, server, xsrf_token):
self.xsrf_token = xsrf_token
self.access_token = None
BaseHTTPRequestHandler.__init__(self, request, address, server)