Python twisted.web.server.ssl_certificate() Examples

The following are 15 code examples of twisted.web.server.ssl_certificate(). 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 twisted.web.server , or try the search function .
Example #1
Source File: __init__.py    From arnold-usd with Apache License 2.0 6 votes vote down vote up
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile

        try:
            server.start()
        finally:
            server.stop() 
Example #2
Source File: bottle.py    From appengine-bottle-skeleton with Apache License 2.0 6 votes vote down vote up
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler
        
        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']
        
        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile
        
        try:
            server.start()
        finally:
            server.stop() 
Example #3
Source File: bottle.py    From aws-servicebroker with Apache License 2.0 6 votes vote down vote up
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile

        try:
            server.start()
        finally:
            server.stop() 
Example #4
Source File: bottle.py    From malwareHunter with GNU General Public License v2.0 6 votes vote down vote up
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler
        
        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']
        
        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile
        
        try:
            server.start()
        finally:
            server.stop() 
Example #5
Source File: bottle.py    From malwareHunter with GNU General Public License v2.0 6 votes vote down vote up
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler
        
        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']
        
        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile
        
        try:
            server.start()
        finally:
            server.stop() 
Example #6
Source File: bottle.py    From warriorframework with Apache License 2.0 6 votes vote down vote up
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile

        try:
            server.start()
        finally:
            server.stop() 
Example #7
Source File: bottle.py    From warriorframework with Apache License 2.0 6 votes vote down vote up
def run(self, handler):  # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile

        try:
            server.start()
        finally:
            server.stop() 
Example #8
Source File: bottle.py    From POC-EXP with GNU General Public License v3.0 6 votes vote down vote up
def run(self, handler):  # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile

        try:
            server.start()
        finally:
            server.stop() 
Example #9
Source File: bottle.py    From bazarr with GNU General Public License v3.0 6 votes vote down vote up
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile

        try:
            server.start()
        finally:
            server.stop() 
Example #10
Source File: bottle.py    From nlgserv with MIT License 6 votes vote down vote up
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile

        try:
            server.start()
        finally:
            server.stop() 
Example #11
Source File: bottle.py    From EasY_HaCk with Apache License 2.0 6 votes vote down vote up
def run(self, handler):  # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile

        try:
            server.start()
        finally:
            server.stop() 
Example #12
Source File: bottle.py    From aws-mock-metadata with MIT License 6 votes vote down vote up
def run(self, handler): # pragma: no cover
        from cherrypy import wsgiserver
        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler
        
        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']
        
        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile
        
        try:
            server.start()
        finally:
            server.stop() 
Example #13
Source File: bottle.py    From silvia-pi with MIT License 5 votes vote down vote up
def run(self, handler):  # pragma: no cover
        depr(0, 13, "The wsgi server part of cherrypy was split into a new "
                    "project called 'cheroot'.", "Use the 'cheroot' server "
                    "adapter instead of cherrypy.")
        from cherrypy import wsgiserver # This will fail for CherryPy >= 9

        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile

        try:
            server.start()
        finally:
            server.stop() 
Example #14
Source File: bottle.py    From slack-machine with MIT License 5 votes vote down vote up
def run(self, handler):  # pragma: no cover
        depr(0, 13, "The wsgi server part of cherrypy was split into a new "
                    "project called 'cheroot'.", "Use the 'cheroot' server "
                    "adapter instead of cherrypy.")
        from cherrypy import wsgiserver # This will fail for CherryPy >= 9

        self.options['bind_addr'] = (self.host, self.port)
        self.options['wsgi_app'] = handler

        certfile = self.options.get('certfile')
        if certfile:
            del self.options['certfile']
        keyfile = self.options.get('keyfile')
        if keyfile:
            del self.options['keyfile']

        server = wsgiserver.CherryPyWSGIServer(**self.options)
        if certfile:
            server.ssl_certificate = certfile
        if keyfile:
            server.ssl_private_key = keyfile

        try:
            server.start()
        finally:
            server.stop() 
Example #15
Source File: bottle.py    From opsbro with MIT License 4 votes vote down vote up
def run(self, handler): # pragma: no cover
        global gserver
        with CherryPyServer.lck:
            try:
                import cherrypy
                from cherrypy import wsgiserver
            except ImportError:
                from opsbro.log import logger
                logger.info('The librairy cherrypy was not detected on the system, switching to an internal one instead')
                # Cherrypy is not install on the system, try the embedded one
                my_dir = os.path.abspath(os.path.dirname(__file__))
                embedded_cherrypy = os.path.join(my_dir, 'internalcherrypy')
                sys.path.insert(0, embedded_cherrypy)
                try:
                    import cherrypy
                    from cherrypy import wsgiserver
                finally:
                    try:
                        sys.path.remove(embedded_cherrypy)
                    except:
                        pass
                

            _type = 'internal'
            if 'bind_addr' not in self.options:
                _type = 'external'
                self.options['bind_addr'] = (self.host, self.port)

            self.options['wsgi_app'] = handler
            
            certfile = self.options.get('certfile')
            if certfile:
                del self.options['certfile']
            keyfile = self.options.get('keyfile')
            if keyfile:
                del self.options['keyfile']
    
            server = wsgiserver.CherryPyWSGIServer(**self.options)
            if certfile:
                server.ssl_certificate = certfile
            if keyfile:
                server.ssl_private_key = keyfile

            # unix socket have a bug in cherrypy 3.1.X, must hard unset nodelay property
            if _type == 'internal' and getattr(cherrypy, '__version__', '').startswith('3.1'):
                server.nodelay = False

            # Set in gserver our server, bot internal (unix socket)
            # and external (tcp one)
            gserver[_type] = server
        
        try:
            server.start()
        finally:
            server.stop()