--- a/iro/anbieter/smstrade.py Mon Nov 23 00:18:04 2009 +0100
+++ b/iro/anbieter/smstrade.py Tue Nov 24 02:02:41 2009 +0100
@@ -88,6 +88,8 @@
def sendSMS(self,sms,recipients):
"""send SMS with $sms to $recipients"""
+ import logging
+ logging.debug('smstrade.sendSMS(%s,%s)'%(sms, str(recipients)))
sended = []
key = self.key
route = unicode(self.route)
@@ -100,7 +102,7 @@
if tel in sended: #only send message once per recipient
continue
sended.append(tel)
- to = unicode(tel.land+tel.number).strip()
+ to ='00'+tel.land+tel.number
if tel.land == '49':
route=unicode("basic")
else:
@@ -117,6 +119,8 @@
""" This function is the main part of the request to the sms service.
The function has to return a unicode formated string that will represent the answer of the sms service
to the request."""
+ import logging
+ logging.debug('smstrade._send(%s,%s,%s,%s,%s,%s)'%( key, route, to, message, from_, timestamp))
parameters= {"key": key,
"route": route,
"to": to,
@@ -133,6 +137,7 @@
parameters["concat_sms"] = "1" if len(message) > 160 else "0"
params = "&".join( ["%s=%s" % (urllib.quote(k),urllib.quote(v.encode("utf-8"))) for (k, v) in parameters.items()])
+ logging.debug('smstrade._send-parameters:%s\n\t->%s'%(str(parameters), str(params)) )
headers = {"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"}
conn = httplib.HTTPConnection("%s:%i" % (self.gateway, self.gatewayPort))
@@ -142,7 +147,7 @@
data = response.read()
except socket.gaierror:
raise InternetConnectionError("%s:%i" % (self.gateway, self.gatewayPort))
- else:
+ finally:
conn.close()
try: