diff --git a/src/pmidcite/eutils/cmds/base.py b/src/pmidcite/eutils/cmds/base.py index 65d75b4..88a0b6c 100755 --- a/src/pmidcite/eutils/cmds/base.py +++ b/src/pmidcite/eutils/cmds/base.py @@ -348,14 +348,13 @@ def _extract_rsp(self, record, retmode): traceback.print_exc() print('\n**FATAL JSONDecodeError:\n{RECORD}'.format(RECORD=record.decode('utf-8'))) - if retmode == 'text': + if retmode in {'text', 'asn.1'}: ## print('RECORD:', str(record)) return record.decode('utf-8') ## print('RETMODE', retmode) ## print('RECORD', record) - ## print(record) # # # Parse XML root = ElementTree.fromstring(record) - ## print('root.tag', root.tag) - assert root.tag in 'ePostResult', root.tag + print(f'ElementTree.fromstring(record).root:\n{root}') + return root + # TODO + print('root.tag', root.tag) + assert root.tag in 'ePostResult', f'ElementTree.fromstring(record).tag: {root.tag}' dct = {r.tag.lower():r.text for r in root} if 'querykey' in dct: dct['querykey'] = int(dct['querykey'])