Skip to content

Commit

Permalink
using custom xml parsers with recover to True
Browse files Browse the repository at this point in the history
  • Loading branch information
TralahM committed May 16, 2020
1 parent 5dc8ddb commit 067fe76
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion greydot/sms.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"""
import requests
from lxml import etree
from io import StringIO,BytesIO
import os
import urllib.parse

Expand Down Expand Up @@ -84,8 +85,10 @@ def parse_xml_response(response):
"""
print(response)
parser=etree.XMLParser(recover=True)
response = bytes(response, encoding="utf-8")
base = etree.fromstring(response)
base=etree.parse(BytesIO(response),parser)
# base = etree.fromstring(response)
query_result = base.xpath("//query/query_result/status")
query_status = base.xpath("//query/query_status")[0].text
query_code = base.xpath("//query/query_code")[0].text
Expand Down

0 comments on commit 067fe76

Please sign in to comment.