Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 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
Exemplo n.º 6
0
 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
Exemplo n.º 7
0
 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()
Exemplo n.º 8
0
 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
Exemplo n.º 9
0
 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()
Exemplo n.º 10
0
 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()
Exemplo n.º 11
0
 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
Exemplo n.º 12
0
 def _inlinify_toronado(cls, data):
     toronado = appier.import_pip("toronado")
     return toronado.from_string(data)
Exemplo n.º 13
0
 def _inlinify_premailer(cls, data):
     premailer = appier.import_pip("premailer")
     return premailer.transform(data)