本文整理汇总了Python中amazonproduct.API._parse方法的典型用法代码示例。如果您正苦于以下问题:Python API._parse方法的具体用法?Python API._parse怎么用?Python API._parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类amazonproduct.API
的用法示例。
在下文中一共展示了API._parse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getattr
# 需要导入模块: from amazonproduct import API [as 别名]
# 或者: from amazonproduct.API import _parse [as 别名]
'xml.etree.cElementTree': etree.Processor(module='xml.etree.cElementTree'),
'xml.etree.ElementTree': etree.Processor(module='xml.etree.ElementTree'),
'cElementTree': etree.Processor(module='cElementTree'),
'elementtree.ElementTree': etree.Processor(module='elementtree.ElementTree'),
'minidom': minidom.Processor(),
}
print "Collecting test files..."
xml_files = [os.path.join(root, file)
for root, dirs, files in os.walk('.')
for file in files
if os.path.splitext(file)[1].lower() == '.xml']
print "Parsing %i XML files..." % (len(xml_files)*RUNS, )
for label, parser in custom_parsers.items():
print label,
if getattr(parser, 'etree', '') is None:
print 'not installed!'
continue
start = time.clock()
api = API(locale='de', processor=parser)
for i in range(RUNS):
for path in xml_files:
try:
api._parse(open(path))
except Exception, e:
pass
stop = time.clock()
print stop - start