Skip to content

Instantly share code, notes, and snippets.

@callemall
Created July 31, 2013 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save callemall/6123625 to your computer and use it in GitHub Desktop.
Save callemall/6123625 to your computer and use it in GitHub Desktop.
This example grabs account information using the CheckAccount function, but does so through a proxy.
#!/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('CheckAccountRequestType')
# Setup the factory based on the WSDL specs
request.username = 99919991
request.pin = 9991
result = client.service.CheckAccount(request)
if result.errorCode > 0:
print result.errorMessage
else:
print "Status: %s" % result.accountStatusDescription
print "Balance: %d" % result.CallBalance
print "Pending: %d" % result.PendingCallBalance
print "Available: %d" % result.AvailableCallUnits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment