我想用zeep創建一個python soap客戶端,但在嘗試訪問wsdl時遇到了一些問題。無論我嘗試過多少種現有的網絡解決方案,他們都不再工作,或者只是我的情況有點不同。最有希望的是在官方文檔ZEEP解決方案,但它仍然不是做得比較工作:Zeep的Python SOAP客戶端 - 訪問密碼保護wsdl
from requests import Session
from requests.auth import HTTPBasicAuth # or HTTPDigestAuth, or OAuth1, etc.
from zeep import Client
from zeep.transports import Transport
session = Session()
session.auth = HTTPBasicAuth(user, password)
client = Client('https://url/to/my_wsdl.wsdl',
transport=Transport(session=session))
但我得到一個錯誤:
File "C:\Python36-32\lib\site-packages\zeep\client.py", line 124, in __init__
self.wsdl = Document(wsdl, self.transport, strict=strict)
File "C:\Python36-32\lib\site-packages\zeep\wsdl\wsdl.py", line 82, in __init__
root_definitions.resolve_imports()
File "C:\Python36-32\lib\site-packages\zeep\wsdl\wsdl.py", line 234, in resolve_imports
binding.resolve(self)
File "C:\Python36-32\lib\site-packages\zeep\wsdl\definitions.py", line 128, in resolve
operation.resolve(definitions)
File "C:\Python36-32\lib\site-packages\zeep\wsdl\bindings\soap.py", line 428, in resolve
self.output.resolve(definitions, self.abstract.output_message)
File "C:\Python36-32\lib\site-packages\zeep\wsdl\messages\soap.py", line 285, in resolve
self.body = self._resolve_body(info['body'], definitions, parts)
File "C:\Python36-32\lib\site-packages\zeep\wsdl\messages\soap.py", line 423, in _resolve_body
element = part.element.clone()
AttributeError: 'NoneType' object has no attribute 'clone'
我缺少什麼或者做錯了嗎?我在Windows 10上使用python3.6 32bit。所有軟件包都使用pip新安裝。
https://github.com/mvantellingen/python-zeep/issues/437完成。感謝幫助! – Devlige