Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'id' for older filings #1

Open
ThePythonDude opened this issue Nov 28, 2021 · 0 comments
Open

KeyError: 'id' for older filings #1

ThePythonDude opened this issue Nov 28, 2021 · 0 comments

Comments

@ThePythonDude
Copy link

Hello,

I was using the package with the xbrl.zip file from:

https://www.sec.gov/Archives/edgar/data/320193/000119312510238044

Afterwards I tested the code from the "test-parse.py" file.

However, the last parser.parseMainXBRL(txt) throws the following error:


KeyError Traceback (most recent call last)
in
1 with open(os.path.join(folder, main_data_f)) as f:
2 txt = f.read()
--> 3 ctx_elems, data_elems = parser.parseMainXBRL(txt)
4
5 print("parsing result: ")

c:\users\edgar api\src\py-sec-xbrl\pysecxbrl\parsing.py in parseMainXBRL(self, text)
14 #main_elems = root.findall(".//dei:DocumentType",namespaces=root.nsmap)
15 # print(len(main_elems))
--> 16 data_elems = self.getDataElementsAsDict(root)
17 ctx_elems = self.getContextElementsAsDict(root)
18

c:\users\edgar api\src\py-sec-xbrl\pysecxbrl\parsing.py in getDataElementsAsDict(self, tree)
43 item[attr] = elem.attrib[attr]
44
--> 45 res[elem.attrib["id"]] = item
46
47 return res

src\lxml\etree.pyx in lxml.etree._Attrib.getitem()

KeyError: 'id'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant