def __init__(self, app, listener=None, log=None): if not listener: self.listener = ("127.0.0.1", 8000) self.host = "127.0.0.1" self.port = 8000 else: self.listener = listener self.host = None self.port = None self.app = app my_app = self.app(get_urls=False) self.urls = my_app.get_parsed_urls() if log: logging.basicConfig( filename=log, level=logging.DEBUG, format="%(asctime)s %(levelname)s:%(message)s", datefmt="[%m-%d-%Y %H:%M:%S]", ) WSGIServer.__init__(self, listener=self.listener, application=self.application, log=logging) else: WSGIServer.__init__(self, listener=self.listener, application=self.application)
def __init__(self, app, options=None): """ :param app: :param options: """ BaseApplication.__init__(self, app, options) WSGIServer.__init__(self, (self._interface, self._port), self.application)
def __init__(self, addr, handlercls, conf=None): if not conf: class C: pass conf = C() conf.URLS = (('^.*$', HTTPServerHandler, {'cls': handlercls}), ) app = core.WebApplication(conf) WSGIServer.__init__(self, addr, app)
def __init__(self, app, port=8000, host="127.0.0.1", debug=False): self.port = port self.host = host self.app = app my_app = self.app(get_urls=False) self.urls = my_app.get_parsed_urls() WSGIServer.__init__(self, listener=( self.host, self.port), application=self.application)
def __init__(self, app, options=None): """ :param app: :param options: """ assert WSGIServer is not object, "you must install 'gevent'" BaseApplication.__init__(self, app, options) opts = dict(spawn=options.get("spawn") or "default", backlog=options.get("backlog")) WSGIServer.__init__(self, self._bind, self.application, **opts)
def __init__(self, *args, **kwargs): """ WSGI server that simply tracks websockets and send them a proper closing handshake when the server terminates. Other than that, the server is the same as its :class:`gevent.pywsgi.WSGIServer` base. """ _WSGIServer.__init__(self, *args, **kwargs) self.pool = GEventWebSocketPool()
def __init__(self, port=8070, app=create_app(), blueprints=[BaseBlueprint()]): self.port = port self.app = app self.sockets = Sockets(app) with self.app.app_context(): for blueprint in blueprints: self.app.register_blueprint(blueprint, sockets=self.sockets) WSGIServer.__init__( self, ("0.0.0.0", port), self.app, handler_class=WebSocketHandler )
def __init__(self, app, port=8000, host="127.0.0.1", log=None): self.port = port self.host = host self.app = app my_app = self.app(get_urls=False) self.urls = my_app.get_parsed_urls() if log: logging.basicConfig(filename=log, level=logging.DEBUG, format='%(asctime)s %(levelname)s:%(message)s', datefmt="[%m-%d-%Y %H:%M:%S]") WSGIServer.__init__(self, listener=( self.host, self.port), application=self.application, log=logging) else: WSGIServer.__init__(self, listener=( self.host, self.port), application=self.application)
def __init__(self, listener, application=None, backlog=2048, socket_type=socket.SOCK_STREAM, spawn='default', handler_class=None, environ=None, log='default', address_family=socket.AF_INET, **config): self.address_family = address_family self.socket_type = socket_type host, port = listener self.socket = create_socket(host, port, self.address_family, self.socket_type, backlog=backlog) self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.application = application self.sockets = {} if 'namespace' in config: self.resource = config.pop('namespace', 'socket.io') else: self.resource = config.pop('resource', 'socket.io') self.transports = config.pop('transports', None) self.policy_server = None WSGIServer.__init__(self, self.socket, application, None, spawn, log, self.handler_class, environ, **config)
def __init__(self, app, port=8000, host="127.0.0.1", debug=False): self.port = port self.host = host self.app = app WSGIServer.__init__(self, listener=( self.host, self.port), application=self.application)
def __init__(self, sockAddr): self.router = router.Router() WSGIServer.__init__(self, listener=sockAddr, application=self.__application)