Python SOAP client with Zeep - authentication

前端 未结 3 1318
臣服心动
臣服心动 2020-12-28 10:58

I am trying to use Zeep to implement a SOAP client, as it seems the only maintained library at the moment:

  • ZSI looked very good but its latest
3条回答
  •  臣服心动
    2020-12-28 11:54

    For Basic Access Authentication you can use the HTTPBasicAuth class from the requests module, as explained on Zeep documentation http://docs.python-zeep.org/en/master/transport.html:

    from requests.auth import HTTPBasicAuth  # or HTTPDigestAuth, or OAuth1, etc.
    from zeep import Client
    from zeep.transports import Transport
    
    client = Client('http://my-endpoint.com/production.svc?wsdl',
        transport=Transport(http_auth=HTTPBasicAuth(user, password)))
    

提交回复
热议问题