]> code.delx.au - webdl/commitdiff
Added grab_html
authorJames Bunton <jamesbunton@delx.net.au>
Fri, 13 Apr 2012 01:43:08 +0000 (11:43 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Fri, 13 Apr 2012 01:43:08 +0000 (11:43 +1000)
common.py

index 4b89660d03941c4a32caa437f385dbe8401068e6..1ce0008aa4c1d2ca3808d8dc883fb5b696e94614 100644 (file)
--- a/common.py
+++ b/common.py
@@ -1,6 +1,6 @@
 # vim:ts=4:sts=4:sw=4:noet
 
-from lxml import etree
+from lxml import etree, html
 import json
 try:
        import hashlib
@@ -85,6 +85,12 @@ def urlopen(url, max_age):
 
        return open(filename)
 
+def grab_html(url, max_age):
+       f = urlopen(url, max_age)
+       doc = html.parse(f)
+       f.close()
+       return doc
+
 def grab_xml(url, max_age):
        f = urlopen(url, max_age)
        doc = etree.parse(f)