Created
July 31, 2013 16:28
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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