Browse Source

fix encoding issue by using the beautiful request

pull/128/head
Sébastien BEAU 9 years ago
committed by MonsieurB
parent
commit
45502332d7
  1. 13
      smsclient_ovh/sms_gateway.py

13
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)
Loading…
Cancel
Save