Explicit code generation from WSDL file for autocomplete?
I'm using the suds library as a SOAP client in some project. I would like to know if there was a way to generate Python code according to the WSDL file.
For example, consider the following line to be from the WSDL file:
<operation name="GetLastTradePrice">
Then, I want to get in some .py
file the auto-generated function
def GetLastTradePrice...
The purpose of that is to be able to know what are my possible functions and properties when I have a client. That means that if I will write:
from suds.client import Client
client = Client(SOME_URL)
Th开发者_运维问答en, after typing the folloewing
client.service.
I will get the option of auto-completion GetLastTradePrice
.
Ye olde ZSI library can generate Python code from a WSDL definition but, compared to suds, it's quite painful to use and requires another really old module called PyXML. I'd stick to suds, auto-completion isn't worth all that.
There are many SOAP server implementations for python, some more usable than others, search for packages related to SOAP at PyPI or take a look at the wiki page about web services at python.org. There are essentially two types of SOAP servers for python:
- Servers that can generate server stubs from WSDL files (like ZSI)
- Servers that can produce WSDL from the service class methods directly (like soaplib, ladon)
精彩评论