Beispiel #1
0
 def check(self, url):
     content = utils.read_content(url)
     parser = HTMLTagParser()
     parser.feed(content)
     unmatch_tags = parser.close()
     for t in unmatch_tags:
         GLog.warning(
             "Broken %s tag[%s] in pos[%s,%s] in url: %s",
             "start" if t.start else "end",
             t.name,
             t.pos[0],
             t.pos[1],
             url,
         )
     if len(unmatch_tags) != 0:
         return 1
     else:
         return 0
Beispiel #2
0
def test():
    import lib.utils as utils
    print utils.read_content("www.12306.cn/123")
    test_HTTPStatusChecker()