本文整理汇总了Python中suds.client.Client.dict方法的典型用法代码示例。如果您正苦于以下问题:Python Client.dict方法的具体用法?Python Client.dict怎么用?Python Client.dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类suds.client.Client
的用法示例。
在下文中一共展示了Client.dict方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: to_dict
# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import dict [as 别名]
def to_dict(sudsobject):
# Convert a WSDL Type instance into a dictionary
if sudsobject is None:
return { }
elif isinstance(sudsobject, list):
ret = [ ]
for item in sudsobject:
ret.append(Client.dict(item))
return ret
return Client.dict(sudsobject)
示例2: WebService
# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import dict [as 别名]
class WebService(object):
def __init__(self, url, username=None, password=None, proxy_netloc=None):
# faults=True raise faults raised by server, else return tuple from service method invocation as (httpcode, object).
# timeout=180 default suds transport timeout is 90 seconds
# use logging plugin collect last sent/received
self.logging_plugin = LoggingWebServicePlugin()
options = DictObject(timeout=180, faults=True, plugins=[self.logging_plugin])
if not VEIL_ENV.is_prod:
options.cache = None
if username:
options.username = username
options.password = password
self.suds_client = Client(url, **options)
self.proxy_netloc = str(proxy_netloc) if proxy_netloc else None
def new_object_of_type(self, wsdl_type, returns_dict_object=False):
suds_object = self.suds_client.factory.create(wsdl_type)
if returns_dict_object:
return DictObject(self.suds_client.dict(suds_object))
return suds_object
def last_sent(self):
return self.logging_plugin.last_sent()
def last_received(self):
return self.logging_plugin.last_received()
def __getattr__(self, item):
service = getattr(self.suds_client.service, item)
if self.proxy_netloc:
service.method.location = RE_NETLOC.sub(self.proxy_netloc, service.method.location, count=1)
return service
示例3: checkOpenid
# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import dict [as 别名]
def checkOpenid(openid):
client = Client('http://172.16.10.107/uapws/service/nc.ws.intf.IPsnService?wsdl')
result = client.service.checkOpenId(openid)
print client
# result = simplejson.loads(result)
result = Client.dict(result)
return result
示例4: WebService
# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import dict [as 别名]
class WebService(object):
def __init__(self, url, use_real_url, **kwargs):
self.use_real_url = use_real_url
self.suds_client = Client(url, timeout=180, **kwargs) # default suds transport timeout is 90 seconds
self.service_url = str(url.replace('?wsdl', '')) # to work around erp tunnel port not preserved bug
def new_object_of_type(self, wsdl_type, returns_dict_object=False):
suds_object = self.suds_client.factory.create(wsdl_type)
if returns_dict_object:
return DictObject(self.suds_client.dict(suds_object))
return suds_object
def last_sent(self):
return self.suds_client.last_sent()
def last_received(self):
return self.suds_client.last_received()
def __getattr__(self, item):
service = getattr(self.suds_client.service, item)
if not self.use_real_url:
service.method.location = self.service_url
return service
示例5: Client
# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import dict [as 别名]
from suds.client import Client
import csv
url = "http://brickset.com/api/v2.asmx?WSDL"
namespace = "http://brickset.com/api/"
apikey = "LqqM-WlJg-Ik6b"
username = "ChristineTham"
password = "castle5052"
brickset = Client(url)
# print brickset
themes = brickset.service.getThemes(apikey)
theme = themes['themes'][0]
with open("themes.csv", 'wb') as csvfile:
csvwriter = csv.DictWriter(csvfile, brickset.dict(theme).keys().sort(), dialect='excel', quoting=csv.QUOTE_NONNUMERIC)
csvwriter.writerow(["theme", "setCount", "subthemeCount", "yearFrom", "yearTo"])
for theme in themes['themes']:
csvwriter.writerow([theme.theme, theme.setCount, theme.subthemeCount, theme.yearFrom, theme.yearTo])