私はSUDSを使用しようとしており、なぜ認証(つまりhttps)を取得できないのか把握しようとしています。Python SUDS httpsサービス401へのSOAPリクエスト
私がアクセスしようとしているサービスは、基本ダイジェスト認証のhttpsを超えています。デバッグに基づいて、httpsではなくhttpを使用しているようです。しかし、私が紛失しているものは本当にわからない。どんな手がかりもありがとう。
from suds.client import Client
from suds.transport.http import HttpAuthenticated
import logging
logging.basicConfig(level=logging.DEBUG)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
logging.getLogger('suds.xsd.schema').setLevel(logging.DEBUG)
logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)
def main():
url = 'https://blah.com/soap/sp/Services?wsdl'
credentials = dict(username='xxxx', password='xxxx')
t = HttpAuthenticated(**credentials)
client = Client(url, location='https://blah.com/soap/sp/Services', transport=t)
print client.last_sent()
if __name__=="__main__":
main()
デバッグ出力:
DEBUG:suds.wsdl:reading wsdl at: https://blah.com/soap/sp/Services?wsdl ... DEBUG:suds.transport.http:opening (https://blah.com/soap/sp/Services?wsdl)
snip ...
File "C:\Python27\Lib\site-packages\suds-0.4-py2.7\suds\reader.py", line 95, in download
fp = self.options.transport.open(Request(url))File "C:\Python27\Lib\site-packages\suds-0.4-py2.7\suds\transport\http.py", line 173, in open
return HttpTransport.open(self, request)File "C:\Python27\Lib\site-packages\suds-0.4-py2.7\suds\transport\http.py", line 64, in open
raise TransportError(str(e), e.code, e.fp)suds.transport.TransportError: HTTP Error 401: Authorization Required
正しさのために最初に...それだけではない「認証ダイジェスト」であるべきである「基本的なダイジェスト認証を。」 authのタイプは 'digest'と 'basic'です。だから私は混乱していた。 – user9303