Python http.server.BaseHTTPRequestHandler.__init__() Examples
The following are 22
code examples of http.server.BaseHTTPRequestHandler.__init__().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
http.server.BaseHTTPRequestHandler
, or try the search function
.
Example #1
Source File: httpd.py From temboard-agent with PostgreSQL License | 6 votes |
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)
Example #2
Source File: proxy.py From BaseProxy with GNU General Public License v2.0 | 6 votes |
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''
Example #3
Source File: proxy.py From BaseProxy with GNU General Public License v2.0 | 6 votes |
def __init__(self, request,proxy_socket): HttpTransfer.__init__(self) self.request = request h = HTTPResponse(proxy_socket) h.begin() ##HTTPResponse会将所有chunk拼接到一起,因此会直接得到所有内容,所以不能有Transfer-Encoding del h.msg['Transfer-Encoding'] del h.msg['Content-Length'] self.response_version =self.version_dict[h.version] self.status = h.status self.reason = h.reason self.set_headers(h.msg) body_data = self._decode_content_body(h.read(),self.get_header('Content-Encoding')) self.set_body_data(body_data) self._text()#尝试将文本进行解码 h.close() proxy_socket.close()
Example #4
Source File: proxy.py From weevely3 with GNU General Public License v3.0 | 5 votes |
def __init__(self, response_str): self._file = BytesIO(response_str)
Example #5
Source File: token.py From python-alerta-client with Apache License 2.0 | 5 votes |
def __init__(self, request, address, server, xsrf_token): self.xsrf_token = xsrf_token self.access_token = None BaseHTTPRequestHandler.__init__(self, request, address, server)
Example #6
Source File: __init__.py From cloud-volume with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, cutouts, *args): self.cutouts = cutouts BaseHTTPRequestHandler.__init__(self, *args)
Example #7
Source File: server.py From cloud-volume with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, cloudpath, *args): self.storage = Storage(cloudpath) BaseHTTPRequestHandler.__init__(self, *args)
Example #8
Source File: agent.py From mamonsu with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, config, *args): self.sender = config.sender BaseHTTPRequestHandler.__init__(self, *args)
Example #9
Source File: agent.py From mamonsu with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, config): def handler(*args): AgentApiHandler(config, *args) server = HTTPServer((config.host, config.port), handler) server.serve_forever()
Example #10
Source File: agent.py From mamonsu with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #11
Source File: base_bot_request_handler.py From hangoutsbot with GNU Affero General Public License v3.0 | 5 votes |
def __init__(self, *args): self.sinkname = self.__class__.__name__ if(args[0]): self.bot = args[0] self._bot = self.bot # backward-compatibility
Example #12
Source File: base_bot_request_handler.py From hangoutsbot with GNU Affero General Public License v3.0 | 5 votes |
def __init__(self, *args): self.sinkname = self.__class__.__name__ BaseHTTPRequestHandler.__init__(self, *args)
Example #13
Source File: proxy.py From weevely3 with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): self.tls = threading.local() self.tls.conns = {} BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
Example #14
Source File: server.py From custodia with GNU General Public License v3.0 | 5 votes |
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
Example #15
Source File: proxy.py From BaseProxy with GNU General Public License v2.0 | 5 votes |
def __init__(self,server): self.server = server
Example #16
Source File: proxy.py From BaseProxy with GNU General Public License v2.0 | 5 votes |
def __init__(self,request,client_addr,server): self.is_connected = False BaseHTTPRequestHandler.__init__(self,request,client_addr,server)
Example #17
Source File: proxy.py From BaseProxy with GNU General Public License v2.0 | 5 votes |
def __init__(self,ca_file = "ca.pem", cert_file = 'ca.crt'): self.ca_file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),ca_file) self.cert_file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), cert_file) self._gen_ca()#生成CA证书,需要添加到浏览器的合法证书机构中
Example #18
Source File: proxy.py From BaseProxy with GNU General Public License v2.0 | 5 votes |
def __init__(self,req): HttpTransfer.__init__(self) self.hostname = req.hostname self.port = req.port # 这是请求 self.command = req.command self.path = req.path self.request_version = req.request_version self.set_headers(req.headers) if self.get_header('Content-Length'): self.set_body_data(req.rfile.read(int(self.get_header('Content-Length'))))
Example #19
Source File: aem_hacker.py From aem-hacker with MIT License | 5 votes |
def __init__(self, token, d, *args): self.d = d self.token = token BaseHTTPRequestHandler.__init__(self, *args)
Example #20
Source File: server.py From custodia with GNU General Public License v3.0 | 5 votes |
def __init__(self, srvurl, config): url = urlparse(srvurl) serverclass, address = self._get_serverclass(url) if sd is not None: address = self._get_systemd_socket(address) self.httpd = serverclass(address, self.handler, config)
Example #21
Source File: server.py From custodia with GNU General Public License v3.0 | 5 votes |
def __init__(self, request, client_address, server): self.requestline = '' self.request_version = '' self.command = '' self.raw_requestline = None self.close_connection = 0 self.path = None # quoted, raw path self.path_chain = None # tuple of unquoted segments self.query = None self.url = None self.body = None self.loginuid = None self._creds = False BaseHTTPRequestHandler.__init__(self, request, client_address, server)
Example #22
Source File: server.py From custodia with GNU General Public License v3.0 | 5 votes |
def __init__(self, server_address, handler_class, config, context=None, bind_and_activate=True): ForkingHTTPServer.__init__(self, server_address, handler_class, config, bind_and_activate=bind_and_activate) if context is None: try: self._context = self._mkcontext() except Exception as e: logger.error( "Failed to create a SSLContext for TLS server: %s", e ) raise else: self._context = context