Python BaseHTTPServer.HTTPServer.__init__() Examples

The following are 30 code examples of BaseHTTPServer.HTTPServer.__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 BaseHTTPServer.HTTPServer , or try the search function .
Example #1
Source File: Eaglepy.py    From PyEagle with GNU Lesser General Public License v2.1 6 votes vote down vote up
def __init__(self,parent=None):
        ULObject.__init__(self,parent)
        self.createAttribute("angle",float)
        self.createAttribute("column",str)
        self.createAttribute("gate",ULGate)
        self.createAttribute("mirror",int)
        self.createAttribute("name",str)
        #self.createAttribute("part",ULPart)
        self.createAttribute("row",str)
        self.createAttribute("sheet",int)
        self.createAttribute("smashed",int)
        self.createAttribute("value",str)
        self.createAttribute("x",int)
        self.createAttribute("y",int)
        self.createAttribute("attributes",[ULAttribute])
        self.createAttribute("texts",[ULText])
        self.createAttribute("xrefs",[ULGate]) 
Example #2
Source File: serving.py    From recruit with Apache License 2.0 6 votes vote down vote up
def __init__(
        self,
        host,
        port,
        app,
        processes=40,
        handler=None,
        passthrough_errors=False,
        ssl_context=None,
        fd=None,
    ):
        if not can_fork:
            raise ValueError("Your platform does not support forking.")
        BaseWSGIServer.__init__(
            self, host, port, app, handler, passthrough_errors, ssl_context, fd
        )
        self.max_children = processes 
Example #3
Source File: Eaglepy.py    From PyEagle with GNU Lesser General Public License v2.1 6 votes vote down vote up
def __init__(self,parent=None):
        ULObject.__init__(self,parent)
        self.createAttribute("area",ULArea)
        self.createAttribute("description",str)
        self.createAttribute("grid",ULGrid)
        self.createAttribute("headline",str)
        self.createAttribute("name",str)
        self.createAttribute("attributes",[ULAttribute])
        self.createAttribute("circles",[ULCircle])
        self.createAttribute("classes",[ULClass])
        self.createAttribute("dimensions",[ULDimension])
        self.createAttribute("elements",[ULElement])
        self.createAttribute("frames",[ULFrame])
        self.createAttribute("holes",[ULHole])
        self.createAttribute("layers",[ULLayer])
        self.createAttribute("libraries",[ULLibrary])
        self.createAttribute("polygons",[ULPolygon])
        self.createAttribute("rectangles",[ULRectangle])
        self.createAttribute("signals",[ULSignal])          
        self.createAttribute("texts",[ULText])
        self.createAttribute("variantdefs",[ULVariantDef])
        self.createAttribute("wires",[ULWire]) 
Example #4
Source File: Eaglepy.py    From PyEagle with GNU Lesser General Public License v2.1 6 votes vote down vote up
def __init__(self,parent=None):
        ULObject.__init__(self,parent)
        self.createAttribute("angle",float)
        self.createAttribute("attribute",str,args=[(str)])
        self.createAttribute("column",str)
        self.createAttribute("locked",int)
        self.createAttribute("mirror",int)
        self.createAttribute("name",str)
        self.createAttribute("package",ULPackage)
        self.createAttribute("populate",int)
        self.createAttribute("row",str)
        self.createAttribute("smashed",int)
        self.createAttribute("spin",int)
        self.createAttribute("value",int)
        self.createAttribute("x",int)
        self.createAttribute("y",int)
        self.createAttribute("attributes",[ULAttribute])
        self.createAttribute("texts",[ULText])
        self.createAttribute("variants",[ULVariant]) 
Example #5
Source File: Eaglepy.py    From PyEagle with GNU Lesser General Public License v2.1 6 votes vote down vote up
def __init__(self,parent=None):
        ULObject.__init__(self,parent)
        self.createAttribute("area",ULArea)
        self.createAttribute("description",str)
        self.createAttribute("headline",str)
        self.createAttribute("library",str)
        self.createAttribute("name",str)
        self.createAttribute("circles",[ULCircle])
        self.createAttribute("contacts",[ULContact])
        self.createAttribute("dimensions",[ULDimension])
        self.createAttribute("frames",[ULFrame])
        self.createAttribute("holes",[ULHole])
        self.createAttribute("polygons",[ULPolygon])
        self.createAttribute("rectangles",[ULRectangle])
        self.createAttribute("texts",[ULText])
        self.createAttribute("wires",[ULWire]) 
Example #6
Source File: Eaglepy.py    From PyEagle with GNU Lesser General Public License v2.1 6 votes vote down vote up
def __init__(self,parent=None):
        ULObject.__init__(self,parent)
        self.createAttribute("alwaysvectorfont",int)
        self.createAttribute("description",str)
        self.createAttribute("grid",ULGrid)
        self.createAttribute("headline",str)
        self.createAttribute("name",str)
        self.createAttribute("verticaltext",int)
        self.createAttribute("xreflabel",str)
        self.createAttribute("attributes",[ULAttribute])
        self.createAttribute("classes",[ULClass])
        self.createAttribute("layers",[ULLayer])
        self.createAttribute("libraries",[ULLibrary])
        self.createAttribute("nets",[ULNet])
        self.createAttribute("parts",[ULPart])          
        self.createAttribute("sheets",[ULSheet])
        self.createAttribute("instances",[ULInstance])
        self.createAttribute("variantdefs",[ULVariantDef]) 
Example #7
Source File: Eaglepy.py    From PyEagle with GNU Lesser General Public License v2.1 6 votes vote down vote up
def __init__(self,contextObject):
        list.__init__(self)
        self.contextObject = contextObject
        self.groupsFilePath = None
        self._enabledupdates = True
        
        if not self.contextObject in [ULBoard,ULSchematic]:
            raise EaglepyException("Invalid context object")
       
        matches = re.match("(.+)\.[\w\d]+",self.contextObject().name())
        if not matches or len(matches.groups()) < 1:
            return
         
        self.groupsFilePath = matches.groups()[0] + ".epy"
        
        self._loadfromxml() 
Example #8
Source File: Eaglepy.py    From PyEagle with GNU Lesser General Public License v2.1 6 votes vote down vote up
def __init__(self,parent=None):
        ULObject.__init__(self,parent)
        self.createAttribute("angle",float)
        self.createAttribute("direction",int)
        self.createAttribute("function",int)
        self.createAttribute("length",int)
        self.createAttribute("name",str)
        self.createAttribute("net",str)
        self.createAttribute("route",int)
        self.createAttribute("swaplevel",int)
        self.createAttribute("visible",int)
        self.createAttribute("x",int)
        self.createAttribute("y",int)
        self.createAttribute("circles",[ULCircle])
        self.createAttribute("contacts",[ULContact])
        self.createAttribute("texts",[ULText])
        self.createAttribute("wires",[ULWire]) 
Example #9
Source File: httpserver.py    From mishkal with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, server_address, RequestHandlerClass,
                     ssl_context=None, request_queue_size=None):
            # This overrides the implementation of __init__ in python's
            # SocketServer.TCPServer (which BaseHTTPServer.HTTPServer
            # does not override, thankfully).
            HTTPServer.__init__(self, server_address, RequestHandlerClass)
            self.socket = socket.socket(self.address_family,
                                        self.socket_type)
            self.ssl_context = ssl_context
            if ssl_context:
                class TSafeConnection(tsafe.Connection):
                    def settimeout(self, *args):
                        self._lock.acquire()
                        try:
                            return self._ssl_conn.settimeout(*args)
                        finally:
                            self._lock.release()
                self.socket = TSafeConnection(ssl_context, self.socket)
            self.server_bind()
            if request_queue_size:
                self.socket.listen(request_queue_size)
            self.server_activate() 
Example #10
Source File: ssl_servers.py    From oss-ftp with MIT License 5 votes vote down vote up
def __init__(self, context, host=HOST, handler_class=None):
        self.flag = None
        self.server = HTTPSServer((host, 0),
                                  handler_class or RootedHTTPRequestHandler,
                                  context)
        self.port = self.server.server_port
        threading.Thread.__init__(self)
        self.daemon = True 
Example #11
Source File: server.py    From Sony-PMCA-RE with MIT License 5 votes vote down vote up
def __init__(self, certFile, fakeHost, host='127.0.0.1', port=4443):
  HTTPServer.__init__(self, (host, port), HttpHandler)
  self.host = host
  self.port = port
  self.url = 'https://' + host + '/'
  self.fakeUrl = 'https://' + fakeHost + '/'
  self.apk = None
  self.result = None
  self.socket = ssl.wrap_socket(self.socket, server_side=True, ssl_version=ssl.PROTOCOL_TLSv1, certfile=certFile) 
Example #12
Source File: server.py    From Sony-PMCA-RE with MIT License 5 votes vote down vote up
def __init__(self, host):
  self.base = 'https://' + host 
Example #13
Source File: serving.py    From RSSNewsGAE with Apache License 2.0 5 votes vote down vote up
def __init__(self, host, port, app, processes=40, handler=None,
                 passthrough_errors=False, ssl_context=None, fd=None):
        if not can_fork:
            raise ValueError('Your platform does not support forking.')
        BaseWSGIServer.__init__(self, host, port, app, handler,
                                passthrough_errors, ssl_context, fd)
        self.max_children = processes 
Example #14
Source File: test_ssl.py    From BinderFilter with MIT License 5 votes vote down vote up
def __init__(self, certfile):
            self.flag = None
            self.active = False
            self.server = self.EchoServer(certfile)
            self.port = self.server.port
            threading.Thread.__init__(self)
            self.daemon = True 
Example #15
Source File: test_ssl.py    From BinderFilter with MIT License 5 votes vote down vote up
def __init__(self, certfile):
            self.flag = None
            self.RootedHTTPRequestHandler.root = os.path.split(CERTFILE)[0]
            self.server = self.HTTPSServer(
                (HOST, 0), self.RootedHTTPRequestHandler, certfile)
            self.port = self.server.server_port
            threading.Thread.__init__(self)
            self.daemon = True 
Example #16
Source File: serving.py    From RSSNewsGAE with Apache License 2.0 5 votes vote down vote up
def __init__(self, protocol):
        self._protocol = protocol
        self._certfile = None
        self._keyfile = None
        self._password = None 
Example #17
Source File: serving.py    From RSSNewsGAE with Apache License 2.0 5 votes vote down vote up
def __init__(self, host, port, app, handler=None,
                 passthrough_errors=False, ssl_context=None, fd=None):
        if handler is None:
            handler = WSGIRequestHandler

        self.address_family = select_ip_version(host, port)

        if fd is not None:
            real_sock = socket.fromfd(fd, self.address_family,
                                      socket.SOCK_STREAM)
            port = 0
        HTTPServer.__init__(self, (host, int(port)), handler)
        self.app = app
        self.passthrough_errors = passthrough_errors
        self.shutdown_signal = False
        self.host = host
        self.port = self.socket.getsockname()[1]

        # Patch in the original socket.
        if fd is not None:
            self.socket.close()
            self.socket = real_sock
            self.server_address = self.socket.getsockname()

        if ssl_context is not None:
            if isinstance(ssl_context, tuple):
                ssl_context = load_ssl_context(*ssl_context)
            if ssl_context == 'adhoc':
                ssl_context = generate_adhoc_ssl_context()
            # If we are on Python 2 the return value from socket.fromfd
            # is an internal socket object but what we need for ssl wrap
            # is the wrapper around it :(
            sock = self.socket
            if PY2 and not isinstance(sock, socket.socket):
                sock = socket.socket(sock.family, sock.type, sock.proto, sock)
            self.socket = ssl_context.wrap_socket(sock, server_side=True)
            self.ssl_context = ssl_context
        else:
            self.ssl_context = None 
Example #18
Source File: createlivestream_wx.py    From p2ptv-pi with MIT License 5 votes vote down vote up
def __init__(self, redirectstderrout = False):
        self.bgapp = None
        self.systray = None
        wx.App.__init__(self, redirectstderrout) 
Example #19
Source File: createlivestream_wx.py    From p2ptv-pi with MIT License 5 votes vote down vote up
def __init__(self, wxapp, bgapp, iconfilename):
        wx.TaskBarIcon.__init__(self)
        self.bgapp = bgapp
        self.wxapp = wxapp
        self.icons = wx.IconBundle()
        self.icon = wx.Icon(iconfilename, wx.BITMAP_TYPE_ICO)
        self.icons.AddIcon(self.icon)
        if sys.platform != 'darwin':
            self.SetIcon(self.icon, self.bgapp.appname)
        else:
            menuBar = wx.MenuBar()
            filemenu = wx.Menu()
            item = filemenu.Append(-1, 'E&xit', 'Terminate the program')
            self.Bind(wx.EVT_MENU, self.OnExit, item)
            wx.App.SetMacExitMenuItemId(item.GetId()) 
Example #20
Source File: serving.py    From lambda-packs with MIT License 5 votes vote down vote up
def __init__(self, rfile):
        self._rfile = rfile
        self._done = False
        self._len = 0 
Example #21
Source File: server.py    From Sony-PMCA-RE with MIT License 5 votes vote down vote up
def __init__(self, file):
  BytesIO.__init__(self)
  self.wrappedFile = file 
Example #22
Source File: httpserver.py    From mishkal with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, wsgi_application, server_address,
                 RequestHandlerClass=None, ssl_context=None,
                 nworkers=10, daemon_threads=False,
                 threadpool_options=None, request_queue_size=None):
        WSGIServerBase.__init__(self, wsgi_application, server_address,
                                RequestHandlerClass, ssl_context,
                                request_queue_size=request_queue_size)
        if threadpool_options is None:
            threadpool_options = {}
        ThreadPoolMixIn.__init__(self, nworkers, daemon_threads,
                                 **threadpool_options) 
Example #23
Source File: httpserver.py    From mishkal with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, wsgi_application, server_address,
                 RequestHandlerClass=None, ssl_context=None,
                 request_queue_size=None):
        SecureHTTPServer.__init__(self, server_address,
                                  RequestHandlerClass, ssl_context,
                                  request_queue_size=request_queue_size)
        self.wsgi_application = wsgi_application
        self.wsgi_socket_timeout = None 
Example #24
Source File: httpserver.py    From mishkal with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, nworkers, daemon=False, **threadpool_options):
        # Create and start the workers
        self.running = True
        assert nworkers > 0, "ThreadPoolMixIn servers must have at least one worker"
        self.thread_pool = ThreadPool(
            nworkers,
            "ThreadPoolMixIn HTTP server on %s:%d"
            % (self.server_name, self.server_port),
            daemon,
            **threadpool_options) 
Example #25
Source File: httpserver.py    From mishkal with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, file, length):
        self.file = file
        self.length = length
        self._consumed = 0
        if hasattr(self.file, 'seek'):
            self.seek = self._seek 
Example #26
Source File: httpserver.py    From mishkal with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, conn):
            self.__conn = conn 
Example #27
Source File: httpserver.py    From mishkal with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, server_address, RequestHandlerClass,
                     ssl_context=None, request_queue_size=None):
            assert not ssl_context, "pyOpenSSL not installed"
            HTTPServer.__init__(self, server_address, RequestHandlerClass)
            if request_queue_size:
                self.socket.listen(request_queue_size) 
Example #28
Source File: httpserver.py    From mishkal with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, rfile, write):
        self._ContinueFile_rfile = rfile
        self._ContinueFile_write = write
        for attr in ('close', 'closed', 'fileno', 'flush',
                     'mode', 'bufsize', 'softspace'):
            if hasattr(rfile, attr):
                setattr(self, attr, getattr(rfile, attr))
        for attr in ('read', 'readline', 'readlines'):
            if hasattr(rfile, attr):
                setattr(self, attr, getattr(self, '_ContinueFile_' + attr)) 
Example #29
Source File: Eaglepy.py    From PyEagle with GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self,name=None):
        self._name = name
        self._parentset = None
        self._enabledupdates = True
        list.__init__(self) 
Example #30
Source File: Eaglepy.py    From PyEagle with GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self,parent=None):
        ULObject.__init__(self,parent)
        self.createAttribute("distance",float)
        self.createAttribute("dots",int)
        self.createAttribute("multiple",int)
        self.createAttribute("on",int)
        self.createAttribute("unit",int)
        self.createAttribute("unitdist",int)