本文整理汇总了Python中http.server.BaseHTTPRequestHandler.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python BaseHTTPRequestHandler.__init__方法的具体用法?Python BaseHTTPRequestHandler.__init__怎么用?Python BaseHTTPRequestHandler.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类http.server.BaseHTTPRequestHandler
的用法示例。
在下文中一共展示了BaseHTTPRequestHandler.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, *args, **kwargs):
from django.conf import settings
self.admin_media_prefix = settings.ADMIN_MEDIA_PREFIX
# We set self.path to avoid crashes in log_message() on unsupported
# requests (like "OPTIONS").
self.path = ''
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
示例2: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, request, client_address, origin):
self.origin = origin
#if __name__ != '__main__':
# self.origin.log('postman initializing as plugin..', 2)
#else:
# self.origin.log('postman initializing as standalone application..', 2)
# ^ works
BaseHTTPRequestHandler.__init__(self, request, client_address, origin)
示例3: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, *args, **kwargs):
from google.appengine._internal.django.conf import settings
self.admin_media_prefix = settings.ADMIN_MEDIA_PREFIX
# We set self.path to avoid crashes in log_message() on unsupported
# requests (like "OPTIONS").
self.path = ''
self.style = color_style()
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
示例4: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, request, client_address, server):
'''
:param request: the request from the client
:param client_address: client address
:param server: HTTP server
'''
BaseHTTPRequestHandler.__init__(
self, request, client_address, server)
self.dataman = None
示例5: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, request, client_address, server):
try:
mimetypes.init()
self.DebugMode = False
BaseHTTPRequestHandler.__init__(self, request, client_address, server)
except:
ReportException()
示例6: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, *args, **kwargs):
sock = socket_wrapper.Socket(unix_socket=True)
sock.make_nonblocking()
if not sock.connect_unix(os.path.expanduser(PETTYCOIN_SOCKET)):
logging.error('Could not open socket: {}'.format(PETTYCOIN_SOCKET))
sys.exit(1)
self.petty_sock = sock
self.petty_reader = JsonSocketReader(sock)
self.html_parser = HTMLParser()
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
示例7: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, http_svc, *args, **kwargs):
"""
Sets up the request handler (called for each request)
:param http_svc: The associated HTTP service
"""
self._service = http_svc
# This calls the do_* methods
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
示例8: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, http_svc, *args, **kwargs):
"""
Constructor
:param http_svc: The associated HTTP service instance
"""
# Store the reference to the service
self.service = http_svc
# Call the parent constructor
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
示例9: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, request, client, server):
request.settimeout(60.)
try:
BaseHTTPRequestHandler.__init__(self, request, client, server)
except OSError as e:
if server.debug:
logger.exception("OSError in http request")
else:
logger.error("%s", e)
except Exception:
logger.exception("Unhandle Error")
示例10: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, request, client_address, server):
"""
override default baseHTTP info
add some variables like: cookies, query, path, etc.
"""
self.server_version = 'Thorin/1.0.3'
self.request_version = 'HTTP/1.1'
self.sys_version = ''
self.response_time = time.time()
self.cookies = {}
self.query = {}
self.path = {}
self.remote_ip = ''
BaseHTTPRequestHandler.__init__(self, request, client_address, server)
示例11: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, request, client_address, server, cpu):
log.error("ControlHandler %s %s %s", request, client_address, server)
self.cpu = cpu
self.get_urls = {
r"/disassemble/(\s+)/$": self.get_disassemble,
r"/memory/(\s+)(-(\s+))?/$": self.get_memory,
r"/memory/(\s+)(-(\s+))?/raw/$": self.get_memory_raw,
r"/status/$": self.get_status,
r"/$": self.get_index,
}
self.post_urls = {
r"/memory/(\s+)(-(\s+))?/$": self.post_memory,
r"/memory/(\s+)(-(\s+))?/raw/$": self.post_memory_raw,
r"/quit/$": self.post_quit,
r"/reset/$": self.post_reset,
r"/debug/$": self.post_debug,
}
BaseHTTPRequestHandler.__init__(self, request, client_address, server)
示例12: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, *args, **kwargs):
"""
"""
global Gd_internalvar
self.__name__ = 'StoreHandler'
self.d_ctlVar = Gd_internalvar
b_test = False
self.b_useDebug = False
self.str_debugFile = '/tmp/pfioh-log.txt'
self.b_quiet = True
self.dp = pfmisc.debug(
verbosity = 0,
level = -1,
within = self.__name__
)
self.pp = pprint.PrettyPrinter(indent=4)
for k,v in kwargs.items():
if k == 'test': b_test = True
if not b_test:
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
示例13: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, config, *args):
self.sender = config.sender
BaseHTTPRequestHandler.__init__(self, *args)
示例14: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self,request,client_addr,server):
self.is_connected = False
BaseHTTPRequestHandler.__init__(self,request,client_addr,server)
示例15: __init__
# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import __init__ [as 别名]
def __init__(self, request, client_address, server):
BaseHTTPRequestHandler.__init__(self, request, client_address, server)