diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ec4ab6..3848322 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -v 1.40.1 [10-Feb-2021] +v 1.40.1 [09-Feb-2021] ---------------------- - Fix #422 diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index 32b9f9e..2e35df8 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -705,20 +705,20 @@ def _get_data_sat(xml): BF = 'string(//*[local-name()="{}"]/@{})' NS_CFDI = {'cfdi': 'http://www.sat.gob.mx/cfd/3'} - # ~ try: - tree = ET.fromstring(xml.encode()) - emisor = escape( - tree.xpath('string(//cfdi:Emisor/@rfc)', namespaces=NS_CFDI) or - tree.xpath('string(//cfdi:Emisor/@Rfc)', namespaces=NS_CFDI) - ) - receptor = escape( - tree.xpath('string(//cfdi:Receptor/@rfc)', namespaces=NS_CFDI) or - tree.xpath('string(//cfdi:Receptor/@Rfc)', namespaces=NS_CFDI) - ) - total = tree.get('total') or tree.get('Total') - uuid = tree.xpath(BF.format('TimbreFiscalDigital', 'UUID')) - # ~ except Exception as e: - # ~ return '' + try: + tree = ET.fromstring(xml.encode()) + emisor = escape( + tree.xpath('string(//cfdi:Emisor/@rfc)', namespaces=NS_CFDI) or + tree.xpath('string(//cfdi:Emisor/@Rfc)', namespaces=NS_CFDI) + ) + receptor = escape( + tree.xpath('string(//cfdi:Receptor/@rfc)', namespaces=NS_CFDI) or + tree.xpath('string(//cfdi:Receptor/@Rfc)', namespaces=NS_CFDI) + ) + total = tree.get('total') or tree.get('Total') + uuid = tree.xpath(BF.format('TimbreFiscalDigital', 'UUID')) + except Exception as e: + return '' data = f'?re={emisor}&rr={receptor}&tt={total}&id={uuid}' return data