|
@ -21,7 +21,7 @@ |
|
|
############################################################################### |
|
|
############################################################################### |
|
|
|
|
|
|
|
|
from openerp import api, models, _ |
|
|
from openerp import api, models, _ |
|
|
import urllib |
|
|
|
|
|
|
|
|
import requests |
|
|
import logging |
|
|
import logging |
|
|
_logger = logging.getLogger(__name__) |
|
|
_logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
@ -82,11 +82,10 @@ class SmsSms(models.Model): |
|
|
@api.multi |
|
|
@api.multi |
|
|
def _send_http_ovh(self): |
|
|
def _send_http_ovh(self): |
|
|
self.ensure_one() |
|
|
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': |
|
|
if response[0:2] != 'OK': |
|
|
raise ValueError(response) |
|
|
raise ValueError(response) |