1
0
mirror of https://github.com/bspeice/metrik synced 2024-11-23 07:38:09 -05:00

HTMLParser is old-style in python 2?

This commit is contained in:
Bradlee Speice 2016-08-08 19:40:40 -04:00
parent e9228d6dad
commit f9caa2555a

View File

@ -22,7 +22,13 @@ class BloombergEquityInfo(Task):
class EquityInfoParser(HTMLParser): class EquityInfoParser(HTMLParser):
def __init__(self, keys): def __init__(self, keys):
super(EquityInfoParser, self).__init__() # This call isn't safe because python 2 HTMLParser is an
# old-style class
try:
super(EquityInfoParser, self).__init__()
except TypeError:
pass
self.keys = keys self.keys = keys
self.records = {k: None for k in keys} self.records = {k: None for k in keys}
self.do_record = {k: False for k in keys} self.do_record = {k: False for k in keys}