Browse Source

[FIX] account_bank_statement_import_online_transferwise: charset

12.0
Alexey Pelykh 4 years ago
parent
commit
1a85dc5747
  1. 7
      account_bank_statement_import_online_transferwise/models/online_bank_statement_provider_transferwise.py

7
account_bank_statement_import_online_transferwise/models/online_bank_statement_provider_transferwise.py

@ -14,6 +14,10 @@ import urllib.request
from odoo import models, api, _ from odoo import models, api, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
import logging
_logger = logging.getLogger(__name__)
TRANSFERWISE_API_BASE = 'https://api.transferwise.com' TRANSFERWISE_API_BASE = 'https://api.transferwise.com'
@ -30,6 +34,7 @@ class OnlineBankStatementProviderTransferwise(models.Model):
url = api_base + '/v1/profiles' url = api_base + '/v1/profiles'
data = self._transferwise_retrieve(url, api_key) data = self._transferwise_retrieve(url, api_key)
except: except:
_logger.warning('Unable to get profiles', exc_info=True)
return [] return []
return list(map( return list(map(
lambda entry: ( lambda entry: (
@ -266,7 +271,7 @@ class OnlineBankStatementProviderTransferwise(models.Model):
def _transferwise_retrieve(self, url, api_key): def _transferwise_retrieve(self, url, api_key):
with self._transferwise_urlopen(url, api_key) as response: with self._transferwise_urlopen(url, api_key) as response:
content = response.read().decode( content = response.read().decode(
response.headers.get_content_charset()
response.headers.get_content_charset() or 'utf-8'
) )
return self._transferwise_validate(content) return self._transferwise_validate(content)

Loading…
Cancel
Save