Has anyone been able to get the suds soap library to work with the NetSuite WSDL? I get this error when I try to create a client.
from suds.client import Cli
It is a bit late, but for the record I attach a way of how one can work with NetSuite SuiteTalk SOAP API using Python Zeep.
Example of NetSuite SOAP login with Python and Zeep followed by adding a customer.
# pip3 install zeep
from zeep import Client
WSDL_URL = 'https://webservices.sandbox.netsuite.com/wsdl/v2016_1_0/netsuite.wsdl'
NS_EMAIL = 'admin@example.com'
NS_PASSWORD = '*********'
NS_ROLE = '1111'
NS_ACCOUNT = '1111111'
NS_APPID = 'FFFFFFFF-FFFF-0000-0000-FFFFFFFFFFFF'
def login_client():
client = Client(WSDL_URL)
Passport = client.get_type('ns1:Passport')
AppInfo = client.get_type('ns5:ApplicationInfo')
passport = Passport(email=NS_EMAIL, password=NS_PASSWORD, account=NS_ACCOUNT)
app_info = AppInfo(applicationId=NS_APPID)
login = client.service.login(passport=passport,
_soapheaders={'applicationInfo': app_info})
print('Login Response: ', login.status)
return client
# Example usage
client = login_client()
# add a customer
Customer = client.get_type('ns14:Customer')
customer = Customer(
lastName='Joe',
firstName='Bloggs',
email='joe@example.com'
)
response = client.service.add(customer)
print(response)
See also: https://github.com/fmalina/python-netsuite