def _get_loggly_api(self): if self._loggly_api: return self._loggly_api try: loggly = appier.import_pip("loggly", package = "loggly_api_python") except Exception: loggly = None if not loggly: return None self._loggly_api = loggly.API(delayer = self.owner.delay) return self._loggly_api
def _get_logstash_api(self): if self._logstash_api: return self._logstash_api try: logstash = appier.import_pip("logstash", package = "logstash_api") except Exception: logstash = None if not logstash: return None self._logstash_api = logstash.API(delayer = self.owner.delay) return self._logstash_api
def _get_api(self): if self._api: return self._api try: loggly = appier.import_pip("loggly", package = "loggly_api_python") except Exception: loggly = None if not loggly: return None self._api = loggly.API() return self._api
def _get_api(self): if self._api: return self._api try: sematext = appier.import_pip("sematext", package = "sematext_api") except Exception: sematext = None if not sematext: return None self._api = sematext.API() return self._api
def _get_api(self): if self._api: return self._api try: sematext = appier.import_pip("sematext", package="sematext_api") except Exception: sematext = None if not sematext: return None self._api = sematext.API() return self._api
def _inlinify_toronado(cls, data, *args, **kwargs): toronado = appier.import_pip("toronado") encoding = kwargs.get("encoding", "utf-8") logging_level = kwargs.get( "logging_level", logging.INFO if appier.is_devel() else logging.ERROR) toronado.logger.setLevel(logging_level) result = toronado.from_string(data) if appier.legacy.is_bytes(result): result = result.decode(encoding) return result
def _inlinify_premailer(cls, data, *args, **kwargs): premailer = appier.import_pip("premailer") keep_style_tags = kwargs.get("keep_style_tags", True) strip_important = kwargs.get("strip_important", False) logging_level = kwargs.get( "logging_level", logging.INFO if appier.is_devel() else logging.ERROR) inliner = premailer.Premailer(data, keep_style_tags=keep_style_tags, strip_important=strip_important, cssutils_logging_level=logging_level) return inliner.transform()
def _inlinify_toronado(cls, data, *args, **kwargs): toronado = appier.import_pip("toronado") encoding = kwargs.get("encoding", "utf-8") logging_level = kwargs.get( "logging_level", logging.INFO if appier.is_devel() else logging.ERROR ) toronado.logger.setLevel(logging_level) result = toronado.from_string(data) if appier.legacy.is_bytes(result): result = result.decode(encoding) return result
def _inlinify_premailer(cls, data, *args, **kwargs): premailer = appier.import_pip("premailer") keep_style_tags = kwargs.get("keep_style_tags", True) strip_important = kwargs.get("strip_important", False) logging_level = kwargs.get( "logging_level", logging.INFO if appier.is_devel() else logging.ERROR ) inliner = premailer.Premailer( data, keep_style_tags = keep_style_tags, strip_important = strip_important, cssutils_logging_level = logging_level ) return inliner.transform()
def _inlinify_premailer(cls, data, *args, **kwargs): premailer = appier.import_pip("premailer") keep_style_tags = appier.conf("PREMAILER_KEEP_TAGS", True, cast = bool) strip_important = appier.conf("PREMAILER_STRIP_IMPORTANT", False, cast = bool) cache_css = appier.conf("PREMAILER_CACHE_CSS", False, cast = bool) validate_css = appier.conf("PREMAILER_VALIDATE_CSS", False, cast = bool) keep_style_tags = kwargs.get("keep_style_tags", keep_style_tags) strip_important = kwargs.get("strip_important", strip_important) logging_level = kwargs.get( "logging_level", logging.INFO if appier.is_devel() else logging.ERROR ) inliner = premailer.Premailer( data, keep_style_tags = keep_style_tags, strip_important = strip_important, cache_css_parsing = cache_css, disable_validation = not validate_css, cssutils_logging_level = logging_level ) return inliner.transform()
def _get_api(self): if self._api: return self._api try: sematext = appier.import_pip("sematext", package = "sematext_api") except: return None self._api = sematext.Api() return self._api
def _inlinify_toronado(cls, data): toronado = appier.import_pip("toronado") return toronado.from_string(data)
def _inlinify_premailer(cls, data): premailer = appier.import_pip("premailer") return premailer.transform(data)