簡體   English   中英

python肥皂水驗證到會員窗口

[英]python soap suds authenticate to affiliatewindow

我嘗試將affiliatewindow- https ://www.affiliatewindow.com-api與python結合使用。 http://v3.core.com.productserve.com/ProductServeService.wsdl

在文檔中:

認證SOAP-Header元素必須與每個單個請求一起發送。

sApiKey(必需),用於驗證用戶的用戶特定密鑰(ProductServe API(ShopWindow客戶端)密碼)值類型:字符串

但它沒有提供有關此標頭外觀的任何示例。

我的代碼:

from suds.xsd.doctor import ImportDoctor, Import
from suds.client import Client

imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
imp.filter.add('http://v3.core.com.productserve.com/')
d = ImportDoctor(imp)
url = 'http://v3.core.com.productserve.com/ProductServeService.wsdl'

client = Client(url, doctor=d) 

ssn =   '<urn:sApiKey>[the-api-key]</urn:sApiKey>'
client.set_options(soapheaders=ssn) 

result = client.service.getMerchantList()
print result

但是我得到的結果是:

suds.WebFault: Server raised fault: 'Authentication Failed'

任何想法如何進行身份驗證? 謝謝!

- - - - - - - - -解決了 - - - - - - - - - - - - - - - -

經過更多研究,我找到了一個ruby示例,將其翻譯為python,這是解決方案:

auth = client.factory.create('UserAuthentication')
auth.sApiKey = [api-key]
client.set_options(soapheaders=auth)

謝謝!

經過更多研究,我找到了一個ruby示例,將其翻譯為python,這是解決方案:

auth = client.factory.create('UserAuthentication')
auth.sApiKey = [api-key]
client.set_options(soapheaders=auth)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM