Skip to content

Instantly share code, notes, and snippets.

@callemall
Created July 31, 2013 16:30
Show Gist options
  • Save callemall/6123639 to your computer and use it in GitHub Desktop.
Save callemall/6123639 to your computer and use it in GitHub Desktop.
In this example the GetBroadcastResult function is used to retrieve the status and result of an in-progress or completed broadcast. The example fetches detailed call-by-call results of a previously created broadcast (versus summary information).
#!/usr/bin/python
# The suds SOAP client is not included in the default Python
# distribution and must be installed manually either by manual
# download or easy_install.
from suds.client import Client
url = 'http://staging-api.call-em-all.com/webservices/ceaapi_v2.asmx?WSDL'
# If access to CEA is via proxy define the following and
# use as an option in the Client call
proxyOpts = dict()
proxyOpts['http'] = 'http://proxy.domain.com:3128'
client = Client(url, proxy=proxyOpts)
# Create a factory based on the WSDL
request = client.factory.create('GetBroadcastResultRequestType')
# Setup the factory based on the WSDL specs
request.username = 99919991
request.pin = 9991
request.broadcastID = 12543 # references an existing broadcast
request.getBroadcastDetails = 1
request.callResultFilter = '*'
result = client.service.GetBroadcastResult(request)
if result.errorCode > 0:
print result.errorMessage
else:
for detail in result.broadcastDetails.CallDetail:
pho = detail.phoneNumber
acc = detail.firstName
nam = detail.lastName
att = detail.numberOfAttempts
tim = detail.lastCallTime
res = detail.callResultName
print "%-10s %-10s %-10s %s %-25s - %s" % (pho,acc,nam,att,tim,res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment