diff --git a/smsclient_ovh/sms_gateway.py b/smsclient_ovh/sms_gateway.py index 1a47c15..e1b93b5 100644 --- a/smsclient_ovh/sms_gateway.py +++ b/smsclient_ovh/sms_gateway.py @@ -21,7 +21,7 @@ ############################################################################### from openerp import api, models, _ -import urllib +import requests import logging _logger = logging.getLogger(__name__) @@ -82,11 +82,10 @@ class SmsSms(models.Model): @api.multi def _send_http_ovh(self): self.ensure_one() - params = self._prepare_http_ovh() - params_encoded = urllib.urlencode(params) - url = "%s?%s" % (self.gateway_id.url, params_encoded) - _logger.debug("Call OVH API : %s", url) - answer = urllib.urlopen(url) - response = answer.read() + params = self._prepare_http_ovh().items() + r = requests.get(self.gateway_id.url, params=params) + _logger.debug("Call OVH API : %s params %s", + self.gateway_id.url, params) + response = r.text if response[0:2] != 'OK': raise ValueError(response)