Python and Salesforce

Well, a few months ago, a couple of the support folks asked me about the feasibility of creating cases in Salesforce through the command line in Python, and after doing a bit of research, I realized (surprisingly) that there really wasn’t a good way to use the Salesforce API in Python *if* you want to parse a WSDL (There is an excellent package called Beatbox if you don’t want or need to parse the XML). There is a very good Python SOAP client out these days called Suds, which unlike ZSI and SOAPpy is able to handle SOAP namespace prefixes (a key for handling Salesforce’s WSDLs), but it doesn’t handle the nitty-gritty details of the SOAP interaction for you (for instance, Salesforce gives you a second URL after login, to which you must send all subsequent requests).

It was out of these thoughts that the Salesforce Python Toolkit was born. My main goal was simply to ensure that a developer using it would have an interface that is 100% compliant with the Salesforce API. It’s basically a lightweight wrapper around Suds, and it handles some minor annoyances and normalizes some of the differences in how Suds parses the Partner and Enterprise WSDL formats. I’ve written up short examples on how to use the entire API (all method calls) with the Toolkit in the EXAMPLES file.

I hope some of you find the project useful, and I certainly look forward to any feedback you may have.

David Lanstein

Posted by