Print WSDL file after authentification with python zeep

896 Views Asked by At

Is there a way to print out or store a wsdl file that requires an authentication using python zeep? I need to download and edit the wsdl file in order to replace some URLs with a proxy. Therefore, I would like to store the wsdl file locally for editing.

A direct download, e.g. wget https:///example.com/my.wsdl is not possible.

Using the terminal command for inspecting a wsdl file does not provide any authentication methods: python -mzeep wsdl_link

Accessing a web service works well, but the XML structure of the complete wsdl is not accessible. At least I don't know how search the API and documentation for this.

from zeep import Client
from requests import Session
from requests.auth import HTTPBasicAuth
from zeep.transports import Transport
session = Session()
session.auth = HTTPBasicAuth('my_user', 'my_password')
wsdl = 'https:///example.com/my.wsdl' 
client = Client(wsdl=wsdl, transport=Transport(session=session))
for service in client.wsdl.services.values():
    print("service:", service.name)

0

There are 0 best solutions below