Skip to content

Commit

Permalink
[REF] Combined pattern analisar_retorno_raw
Browse files Browse the repository at this point in the history
Signed-off-by: Luis Felipe Miléo <[email protected]>
  • Loading branch information
mileo committed Jul 16, 2024
1 parent 69f4c88 commit e63a588
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/erpbrasil/edoc/resposta.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

from lxml import etree

combined_pattern = "|".join(
["<soap:Body>(.*?)</soap:Body>", "<[a-zA-Z0-9:]Body.?>(.*?)</[a-zA-Z0-9:]*Body>"]
)


class RetornoSoap:
def __init__(self, webservice, raiz, xml, retorno, resposta):
Expand All @@ -18,7 +22,7 @@ def __init__(self, webservice, raiz, xml, retorno, resposta):

def analisar_retorno_raw(operacao, raiz, xml, retorno, classe):
retorno.raise_for_status()
pattern = r"<[a-zA-Z0-9:]Body.?>(.*?)</[a-zA-Z0-9:]*Body>"
pattern = re.compile(combined_pattern)
match = re.search(pattern, retorno.text.replace("\n", ""))
if match:
xml_resposta = match.group(1)
Expand Down

0 comments on commit e63a588

Please sign in to comment.