Skip to content

Commit 006f5cf

Browse files
committed
Merge pull request #28 from jesuslosada/master
Minor get_items improvements
2 parents f03464c + ae65cd6 commit 006f5cf

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

microdata.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,14 @@
1111
import simplejson as json
1212

1313

14-
def get_items(location, encoding='UTF-8'):
14+
def get_items(location, encoding=None):
1515
"""
16-
Pass in a file or file-like object and get a list of Items present in the
16+
Pass in a string or file-like object and get a list of Items present in the
1717
HTML document.
1818
"""
1919
dom_builder = html5lib.treebuilders.getTreeBuilder("dom")
2020
parser = html5lib.HTMLParser(tree=dom_builder)
21-
22-
if (sys.version_info.major == 3):
23-
tree = parser.parse(location)
24-
else:
25-
tree = parser.parse(location, encoding=encoding)
26-
21+
tree = parser.parse(location, encoding=encoding)
2722
return _find_items(tree)
2823

2924

0 commit comments

Comments
 (0)