diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-08-24 13:17:53 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-08-24 13:17:53 +0200 |
| commit | 017ee5eab376b4f09beb62812c1cbc682009ed86 (patch) | |
| tree | 2af185b0604cd8ce9129c39137bbf39d21d7be89 /addons/payment_authorize/models/authorize_request.py | |
| parent | 006c16198f7f68c9dc8b895defd013f33008840a (diff) | |
| parent | 877e7098719195ed2934fc9c3b5c3bd8ad8bab07 (diff) | |
[MERGE] forward port branch saas-17 up to 877e7098719
Diffstat (limited to 'addons/payment_authorize/models/authorize_request.py')
| -rw-r--r-- | addons/payment_authorize/models/authorize_request.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/payment_authorize/models/authorize_request.py b/addons/payment_authorize/models/authorize_request.py index fcfab1e3ac2..7388a1a4329 100644 --- a/addons/payment_authorize/models/authorize_request.py +++ b/addons/payment_authorize/models/authorize_request.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- +import io import requests from lxml import etree, objectify -from StringIO import StringIO from xml.etree import ElementTree as ET from uuid import uuid4 @@ -21,7 +21,7 @@ def strip_ns(xml, ns): :rtype: etree._Element :return: the parsed xml string with the namespace prefix removed """ - it = ET.iterparse(StringIO(xml)) + it = ET.iterparse(io.BytesIO(xml)) ns_prefix = '{%s}' % XMLNS for _, el in it: if el.tag.startswith(ns_prefix): @@ -58,7 +58,7 @@ class AuthorizeAPI(): :param etree._Element data: etree data to process """ - data = etree.tostring(data, xml_declaration=True, encoding='utf-8') + data = etree.tostring(data, encoding='utf-8') r = requests.post(self.url, data=data, headers={'Content-Type': 'text/xml'}) r.raise_for_status() response = strip_ns(r.content, XMLNS) |
