本文整理汇总了Python中suds.sax.element.Element.attributes方法的典型用法代码示例。如果您正苦于以下问题:Python Element.attributes方法的具体用法?Python Element.attributes怎么用?Python Element.attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类suds.sax.element.Element
的用法示例。
在下文中一共展示了Element.attributes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_headers
# 需要导入模块: from suds.sax.element import Element [as 别名]
# 或者: from suds.sax.element.Element import attributes [as 别名]
def set_headers(self, name, password):
"""Set the username and password that needs to go in the SOAP header."""
# this SOAP header is required by the API in this form
header = Element('ExternalApiHeader')
if self.service == ApiClient._READONLY:
# we send the username only in the SOAP header
astring = ('version="{0}" currency="GBP" languageCode="en" '
'username="{1}" '
'xmlns="http://www.GlobalBettingExchange'
'.com/ExternalAPI/"'.format(const.BDAQAPIVERSION,
name))
if self.service == ApiClient._SECURE:
# we send the username and password in the SOAP header
astring = ('version="{0}" currency="GBP" languageCode="en" '
'username="{1}" password="{2}" '
'xmlns="http://www.GlobalBettingExchange'
'.com/ExternalAPI/"'.format(const.BDAQAPIVERSION,
name,
password))
# set header
header.attributes = [astring]
self.client.set_options(soapheaders = header)