當前位置: 首頁>>代碼示例>>Python>>正文


Python Client.dict方法代碼示例

本文整理匯總了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)
開發者ID:liliangr,項目名稱:cachita,代碼行數:12,代碼來源:client.py

示例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
開發者ID:honovation,項目名稱:veil,代碼行數:35,代碼來源:web_service.py

示例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
開發者ID:htxstc1984,項目名稱:weixinService_py,代碼行數:9,代碼來源:webservice.py

示例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
開發者ID:chenxc,項目名稱:veil,代碼行數:25,代碼來源:web_service.py

示例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])
開發者ID:ChristineTham,項目名稱:GetBrickset,代碼行數:21,代碼來源:getbrickset4.py


注:本文中的suds.client.Client.dict方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。