[英]Suds not working with python doing xml request
I am using suds 0.4 version with python 2.7. 我在python 2.7中使用suds 0.4版本。 And the simple script does not work giving error "cannot import Client".
而且简单脚本无法正常工作,并显示错误“无法导入客户端”。 Wher eis the problem?
问题出在哪儿?
import suds
from suds.client import Client
client = suds.Client("http://webservices.data-8.co.uk/companieshouse.asmx?WSDL")
result = client.service.GetCompanyDetails("username", "password", 1234)
print result.Status.Succes
I'm assuming you're getting an error like 'module' object has no attribute 'Client'
. 我假设您遇到类似
'module' object has no attribute 'Client'
。
You are calling suds.Client()
which does not exist. 您正在调用不存在的
suds.Client()
。
You have imported Client into your namespace on the line from suds.client import Client
. 您
from suds.client import Client
导入到名称空间中。
suds
exists as a module, Client
exists as a class, and suds.client
exists as a module, but suds.Client
does not exist. suds
存在,作为一个模块, Client
存在的一类,并suds.client
存在作为一个模块,但suds.Client
不存在。 In your case you want to call the constructor Client
, so... 在您的情况下,您想调用构造函数
Client
,因此...
Change your code to client = Client(...)
and it will work if you have suds installed correctly. 将您的代码更改为
client = Client(...)
,如果您正确安装了肥皂水,它将可以使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.