Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107419
| From | Joaquin Alzola <Joaquin.Alzola@lebara.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Xlms namespace |
| Date | 2016-04-20 09:28 +0000 |
| Message-ID | <mailman.35.1461171872.12923.python-list@python.org> (permalink) |
| References | <HE1PR07MB135631A22E59C1644F33C569F06D0@HE1PR07MB1356.eurprd07.prod.outlook.com> |
Hi Guys
I am currently doing this:
IP client(Python) --> send SOAPXML request --> IP Server (Python)
SOAP request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http:/
/request.messagepush.interfaces.comviva.com" xmlns:xsd="http://request.messagepush.interfaces
.comviva.com/xsd">
<xsd:text>test\ntest\ntest<{[£€&%]}></xsd:text>
From my IP Client:
s.send(data_send.encode('utf-8'))
From my IPServer:
xml_decoded = data.decode('utf-8')
xml_root = ET.ElementTree(ET.fromstring(xml_decoded)).getroot()
for elem in xml_root.getiterator():
if('{http://request.messagepush.interfaces.comviva.com/xsd}shortCode'==elem.tag):
shortCode = (elem.text).rstrip()
if('{http://request.messagepush.interfaces.comviva.com/xsd}text'==elem.tag):
send_text = (elem.text).rstrip()
if('{http://request.messagepush.interfaces.comviva.com/xsd}item'==elem.tag):
subscribers = (elem.text).rstrip()
result_sms = send_sms(subscribers,shortCode,send_text)
It is working fine but I am having problems with a couple of special characters, & and <
The problem:
<xsd:text>test\ntest\ntest<{[£€&%]}></xsd:text>
It seems as if I send this: <> and the character & then I have a problem.
I need to use utf-8 as I need to make sure I get 160 characters in one SMS.
Error:
Traceback (most recent call last):
File "./ipserver.py", line 52, in <module>
main()
File "./ipserver.py", line 36, in main
xml_root = ET.ElementTree(ET.fromstring(xml_decoded)).getroot()
File "/usr/lib64/python3.4/xml/etree/ElementTree.py", line 1325, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 19, column 48
This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately upon receipt.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Xlms namespace Joaquin Alzola <Joaquin.Alzola@lebara.com> - 2016-04-20 09:28 +0000
Re: Xlms namespace sohcahtoa82@gmail.com - 2016-04-20 10:52 -0700
RE: Xlms namespace Joaquin Alzola <Joaquin.Alzola@lebara.com> - 2016-04-20 21:43 +0000
csiph-web