Definition at line 27 of file custom_extractor.py.
◆ __init__()
def dc_processor.custom_extractor.CustomExtractor.__init__ |
( |
|
self, |
|
|
|
config, |
|
|
|
templ = None , |
|
|
|
domain = None , |
|
|
|
processorProperties = None |
|
) |
| |
Definition at line 36 of file custom_extractor.py.
36 def __init__(self, config, templ=None, domain=None, processorProperties=None):
38 BaseExtractor.__init__(self, config, templ, domain, processorProperties)
39 logger.debug(
"Properties: %s",
varDump(self.properties))
40 self.name =
"Custom extractor" 42 self.rankReading(self.__class__.__name__)
43 self.data[
"extractor"] = self.name
44 except Exception
as err:
45 ExceptionLog.handler(logger, err,
"Custom extractor constructor error: possible /tmp not permitted to write", (),
46 {ExceptionLog.LEVEL_NAME_ERROR:ExceptionLog.LEVEL_VALUE_DEBUG})
def varDump(obj, stringify=True, strTypeMaxLen=256, strTypeCutSuffix='...', stringifyType=1, ignoreErrors=False, objectsHash=None, depth=0, indent=2, ensure_ascii=False, maxDepth=10)
def __init__(self)
constructor
◆ extractTags()
def dc_processor.custom_extractor.CustomExtractor.extractTags |
( |
|
self, |
|
|
|
resource, |
|
|
|
reslut |
|
) |
| |
Definition at line 54 of file custom_extractor.py.
54 def extractTags(self, resource, reslut):
56 signal.signal(signal.SIGALRM, signal_handler)
57 if 'EXTRACTOR_CUSTOM_MAX_EXECUTION' in self.processorProperties:
58 t = int(self.processorProperties[
'EXTRACTOR_CUSTOM_MAX_EXECUTION'])
60 t = CONSTS.TIME_EXECUTION_LIMIT
62 logger.debug(
"Max execution time signal handler set timeout as: %s", str(t))
65 if resource.raw_html
is not None and isinstance(resource.raw_html, types.DictType):
66 for key
in resource.raw_html:
67 localTagValue = resource.raw_html[key]
if isinstance(resource.raw_html[key], types.ListType)
else \
68 [str(resource.raw_html[key])]
69 self.addTag(result=reslut, tag_name=key, tag_value=localTagValue)
70 except IOError
as err:
71 ExceptionLog.handler(logger, err,
"Custom extractor file error. It may be unsupported encoding like jp", (), \
72 {ExceptionLog.LEVEL_NAME_ERROR:ExceptionLog.LEVEL_VALUE_DEBUG})
73 except Exception
as err:
74 ExceptionLog.handler(logger, err,
"Custom extractor error", (), \
75 {ExceptionLog.LEVEL_NAME_ERROR:ExceptionLog.LEVEL_VALUE_DEBUG})
◆ name
dc_processor.custom_extractor.CustomExtractor.name |
The documentation for this class was generated from the following file: