Skip to content

Instantly share code, notes, and snippets.

@mesuutt
Last active February 25, 2016 12:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mesuutt/7784506 to your computer and use it in GitHub Desktop.
Save mesuutt/7784506 to your computer and use it in GitHub Desktop.
ArasKargo Soap API call example with Python suds library.
import logging
from suds.xsd.doctor import ImportDoctor, Import
from suds.client import Client, WebFault
logger = logging.getLogger(__name__)
wsdl_url = 'http://appls-srv.araskargo.com.tr/arascargoservice/arascargoservice.asmx?WSDL'
client = None
data = {}
imp = Import("http://www.w3.org/2001/XMLSchema")
# Add namespaces. Find in wsdl
imp.filter.add('http://tempuri.org/IrsaliyeData.xsd')
imp.filter.add('http://tempuri.org/WebCargoData.xsd')
doctor = ImportDoctor(imp)
try:
client = Client(wsdl_url, doctor=doctor)
except WebFault as e:
logger.debug(e)
raise e
data['CargoKey'] = 'abc123'
# Fill required data. Look at wsdl for required data
try:
# Look at wsdl_url for more parameters etc.
# SetDispatch is a remote method. Calling over soap.
# Look at print(client) for which methods exists.
response = client.service.SetDispatch(
{'ShippingOrder': data},
userName="abc",
password="123"
)
logger.debug(response)
except WebFault as e:
logger.error("SetDispatch Error: %s" % e)
raise e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment