diff -r 81916344c63b -r 42fd5075a5d1 iro/offer/smstrade.py --- a/iro/offer/smstrade.py Wed Jun 21 00:52:38 2023 +0200 +++ b/iro/offer/smstrade.py Tue Apr 15 01:19:47 2025 +0200 @@ -22,7 +22,7 @@ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -import urllib +import urllib.request, urllib.parse from functools import partial from decimal import Decimal import copy @@ -106,7 +106,7 @@ def __init__(self, name): self.url = "https://gateway.smstrade.de" - options =[("key", Option(lambda x,y:x,long="smstrade Gateway Key https://login.smstrade.de/index.php?gateway", must=True)),] + options =[("key", Option(lambda x,y:x,int="smstrade Gateway Key https://login.smstrade.de/index.php?gateway", must=True)),] Provider.__init__(self, name, {"sms":["basic","economy","gold","direct"]},options) def send(self, route, recipient, sms): @@ -121,8 +121,6 @@ """ #logger.debug('smstrade.sendSMS(%s,%s)'%(sms, recipient)) - route = unicode(route) - if recipient.land != '49' and route == "basic": raise RejectRecipient(recipient) @@ -170,21 +168,21 @@ ps={} for p in parameters: - if p in self._params.keys(): + if p in list(self._params.keys()): if self._params[p][0] == "boolean": if parameters[p] != self._params[p][1]: ps[p]=int(bool(parameters[p])) else: ps[p] = parameters[p] - params = urllib.urlencode(ps) + params = urllib.parse.urlencode(ps) dp=copy.deepcopy(ps) dp["key"]="" - print 'smstrade._send-parameters:%s\n\t->%s'%(str(dp), urllib.urlencode(dp)) + print('smstrade._send-parameters:%s\n\t->%s'%(str(dp), urllib.parse.urlencode(dp))) - response = urllib.urlopen(self.url, params) + response = urllib.request.urlopen(self.url, params) data = response.readlines() - print "result:%s"%(data) + print("result:%s"%(data)) if len(data) == 1: return StatusCode(int(data[0])) return StatusCode(int(data[0]),exID=data[1].strip(),costs=data[2],count=data[3])