0
votes

I am trying to send SMS following Python suds procedure but facing some problems related to urllib2

The API URL, username & are provided by mobile service company when i try to execute the code i receive some errors relate to ###urllib2.URLError###

from suds.client import Client

client = Client(url='https://cbs.zong.com.pk/reachcwsv2  /corporatesms.svc?wsdl',
            username='9231089894269149',
            password='Zo98989ng@123', cache=None)

obj_QuickSMS = client.factory.create('obj_QuickSMS')

obj_QuickSMS.loginId = '91313212304269149'
obj_QuickSMS.loginPassword = 'zqong@435'
obj_QuickSMS.Destination = '923459332997'
obj_QuickSMS.Mask = 'Edex'
obj_QuickSMS.Message = 'HELLO'
obj_QuickSMS.UniCode = '0'
obj_QuickSMS.ShortCodePrefered = 'n'

result = client.service.QuickSMS(obj_QuickSMS)

i am receiving the following error:

File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 1228, in http_open return self.do_open(httplib.HTTPConnection, req)> File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open raise URLError(err) urllib2.URLError:

1
facing this error - Shahid
urllib2.URLError: <urlopen error [Errno -2] Name or service not known> - Shahid
You can edit your question to correct the error message :) - nitzel

1 Answers

1
votes

You have white space in your url, it should be like this:

client = Client(url='https://cbs.zong.com.pk/reachcwsv2/corporatesms.svc?wsdl',
            username='9231089894269149',
            password='Zo98989ng@123', cache=None)