From 1a85dc574754ed2e66af049639cecd21463528c1 Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Thu, 22 Oct 2020 14:34:17 +0300 Subject: [PATCH] [FIX] account_bank_statement_import_online_transferwise: charset --- .../models/online_bank_statement_provider_transferwise.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/account_bank_statement_import_online_transferwise/models/online_bank_statement_provider_transferwise.py b/account_bank_statement_import_online_transferwise/models/online_bank_statement_provider_transferwise.py index 4ed88c1..2006d88 100644 --- a/account_bank_statement_import_online_transferwise/models/online_bank_statement_provider_transferwise.py +++ b/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.exceptions import UserError +import logging +_logger = logging.getLogger(__name__) + + TRANSFERWISE_API_BASE = 'https://api.transferwise.com' @@ -30,6 +34,7 @@ class OnlineBankStatementProviderTransferwise(models.Model): url = api_base + '/v1/profiles' data = self._transferwise_retrieve(url, api_key) except: + _logger.warning('Unable to get profiles', exc_info=True) return [] return list(map( lambda entry: ( @@ -266,7 +271,7 @@ class OnlineBankStatementProviderTransferwise(models.Model): def _transferwise_retrieve(self, url, api_key): with self._transferwise_urlopen(url, api_key) as response: content = response.read().decode( - response.headers.get_content_charset() + response.headers.get_content_charset() or 'utf-8' ) return self._transferwise_validate(content)