如何在Python的zeep库中使用AnyObject方法?

时间:2016-07-28 19:14:35

标签: python xsd python-3.5 webservice-client

我在文档中读到它是这样做的。

enter image description here

我做了一个简单的代码试试这个,我有以下内容。 (ucmdb是客户端)

intProp_type = ucmdb.get_element('ns17:IntProp')
intProp = xsd.AnyObject(intProp_type, intProp_type(name = "slots", value = 56 ))

出现了这个错误。

Traceback (most recent call last):
  File "C:\Python\lib\site-packages\zeep-0.12.0-py3.5.egg\zeep\xsd\schema.py", line 71, in get_element
    return schema._elements[qname]
KeyError: <lxml.etree.QName object at 0x000001C314122F08>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "ejemplo.py", line 35, in <module>
    main()
  File "ejemplo.py", line 18, in main
    processCIs()
  File "ejemplo.py", line 31, in processCIs
    intProp_type = ucmdb.get_element('ns17:IntProp')
  File "C:\Python\lib\site-packages\zeep-0.12.0-py3.5.egg\zeep\client.py", line 119, in get_element
    return self.wsdl.types.get_element(name)
  File "C:\Python\lib\site-packages\zeep-0.12.0-py3.5.egg\zeep\xsd\schema.py", line 81, in get_element
    qname.localname, qname.namespace, known_elements or ' - '))
KeyError: "No element 'IntProp' in namespace http://schemas.hp.com/ucmdb/ui/1/types. Available elements are:  - "

1 个答案:

答案 0 :(得分:0)

您可能想尝试使用最新版本。否则请在github.com/mvantellingen/python-zeep

中提交问题