HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
ftests.ftest_SimpleCharsetDetector.SimpleCharsetDetector Class Reference
Inheritance diagram for ftests.ftest_SimpleCharsetDetector.SimpleCharsetDetector:
Collaboration diagram for ftests.ftest_SimpleCharsetDetector.SimpleCharsetDetector:

Public Member Functions

def __init__ (self, content=None)
 
def detect (self, content=None)
 

Public Attributes

 content
 

Detailed Description

Definition at line 18 of file ftest_SimpleCharsetDetector.py.

Constructor & Destructor Documentation

◆ __init__()

def ftests.ftest_SimpleCharsetDetector.SimpleCharsetDetector.__init__ (   self,
  content = None 
)

Definition at line 21 of file ftest_SimpleCharsetDetector.py.

21  def __init__(self, content=None):
22  #content
23  self.content = content
24 
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ detect()

def ftests.ftest_SimpleCharsetDetector.SimpleCharsetDetector.detect (   self,
  content = None 
)

Definition at line 25 of file ftest_SimpleCharsetDetector.py.

25  def detect(self, content=None):
26  ret = None
27 
28  try:
29  if content is None:
30  cnt = self.content
31  else:
32  cnt = content
33 
34  pattern = r'<meta(?!\s*(?:name|value)\s*=)(?:[^>]*?content\s*=[\s"\']*)?([^>]*?)[\s"\';]*charset\s*=[\s"\']*([^\s"\'/>]*)'
35  matchObj = re.search(pattern, cnt, re.I | re.M | re.S)
36  if matchObj:
37  ret = matchObj.group(2)
38 
39  except Exception, err:
40  del err
41 
42  return ret
43 
44 

Member Data Documentation

◆ content

ftests.ftest_SimpleCharsetDetector.SimpleCharsetDetector.content

Definition at line 23 of file ftest_SimpleCharsetDetector.py.


The documentation for this class was generated from the following file: