最近调用物流接口遇到返回类型为:<class 'suds.sax.text.Text'>
对方使用的是SOAP通信,通过WSDL 方式请求并返回结果,
print type(orcl_quote_resp)
<class 'suds.sax.text.Text'>
父类是一个字符类型
object --+ | basestring --+ | unicode --+ | Text
from xml.sax.saxutils import escape
print type(escape(create_response))
转换成字符类型
create_response = json.loads(escape(create_response))
因为实际需要,该字符包含的是一个字典,转换成字典类型
<class 'suds.sax.text.Text'>具体介绍请查看下面链接:
https://jortel.fedorapeople.org/suds/doc/suds.sax.text.Text-class.html