Beispiel #1
0
    def __init__(self, **settings):
        self.start_time = time.time()

        tornado_settings = settings.get('tornado_settings')
        if tornado_settings is None:
            tornado_settings = {}

        self.app_settings = settings
        self.config = self.application_config()
        self.app = settings.get('app')

        self.xml = frontik.producers.xml_producer.XMLProducerFactory(self)
        self.json = frontik.producers.json_producer.JsonProducerFactory(self)

        AsyncHTTPClient.configure(
            'tornado.curl_httpclient.CurlAsyncHTTPClient',
            max_clients=options.max_http_clients)
        self.http_client = self.curl_http_client = AsyncHTTPClient()

        self.router = FrontikRouter(self)
        self.loggers_initializers = bootstrap_app_loggers(self)

        super(FrontikApplication, self).__init__([
            (r'/version/?', VersionHandler),
            (r'/status/?', StatusHandler),
            (r'.*', self.router),
        ], **tornado_settings)

        self.transforms.insert(0, partial(DebugTransform, self))
Beispiel #2
0
    def __init__(self, **settings):
        self.start_time = time.time()

        tornado_settings = settings.get('tornado_settings')
        if tornado_settings is None:
            tornado_settings = {}

        self.config = self.application_config()
        self.app = settings.get('app')
        self.app_root = settings.get('app_root')

        self.xml = frontik.producers.xml_producer.XMLProducerFactory(self)
        self.json = frontik.producers.json_producer.JsonProducerFactory(self)

        self.http_client_factory = HttpClientFactory(
            self, getattr(self.config, 'http_upstreams', {}))

        self.router = FrontikRouter(self)

        core_handlers = [
            (r'/version/?', VersionHandler),
            (r'/status/?', StatusHandler),
            (r'.*', self.router),
        ]

        if options.debug:
            core_handlers.insert(0, (r'/pydevd/?', PydevdHandler))

        super().__init__(core_handlers, **tornado_settings)
        self.available_integrations, self.default_init_futures = integrations.load_integrations(
            self)
        self.transforms.insert(0, partial(DebugTransform, self))
Beispiel #3
0
    def __init__(self, **settings):
        self.start_time = time.time()

        tornado_settings = settings.get('tornado_settings')
        if tornado_settings is None:
            tornado_settings = {}

        self.config = self.application_config()
        self.app = settings.get('app')
        self.app_module = settings.get('app_module')
        self.app_root = settings.get('app_root')

        self.xml = frontik.producers.xml_producer.XMLProducerFactory(self)
        self.json = frontik.producers.json_producer.JsonProducerFactory(self)

        self.available_integrations = None
        self.service_discovery_client = None
        self.tornado_http_client = None
        self.http_client_factory = None

        self.router = FrontikRouter(self)

        core_handlers = [
            (r'/version/?', VersionHandler),
            (r'/status/?', StatusHandler),
            (r'.*', self.router),
        ]

        if options.debug:
            core_handlers.insert(0, (r'/pydevd/?', PydevdHandler))

        super().__init__(core_handlers, **tornado_settings)
Beispiel #4
0
    def __init__(self, **settings):
        self.start_time = time.time()

        tornado_settings = settings.get('tornado_settings')
        if tornado_settings is None:
            tornado_settings = {}

        self.config = self.application_config()
        self.app = settings.get('app')
        self.app_module = settings.get('app_module')
        self.app_root = settings.get('app_root')

        self.xml = frontik.producers.xml_producer.XMLProducerFactory(self)
        self.json = frontik.producers.json_producer.JsonProducerFactory(self)

        AsyncHTTPClient.configure(
            'tornado.curl_httpclient.CurlAsyncHTTPClient',
            max_clients=options.max_http_clients)
        self.tornado_http_client = AsyncHTTPClient()

        if options.max_http_clients_connects is not None:
            self.tornado_http_client._multi.setopt(
                pycurl.M_MAXCONNECTS, options.max_http_clients_connects)

        self.service_discovery_client = None
        self.http_client_factory = None

        self.router = FrontikRouter(self)

        core_handlers = [
            (r'/version/?', VersionHandler),
            (r'/status/?', StatusHandler),
            (r'.*', self.router),
        ]

        if options.debug:
            core_handlers.insert(0, (r'/pydevd/?', PydevdHandler))

        self.service_discovery_client = get_async_service_discovery(
            options, hostname=socket.gethostname())

        self.available_integrations = None

        super().__init__(core_handlers, **tornado_settings)