From 6ac2db238621cfa9e599669240971b4c510504bc Mon Sep 17 00:00:00 2001 From: "Ronald Portier (Therp BV)" Date: Wed, 15 Mar 2023 09:49:01 +0100 Subject: [PATCH] [FIX] *_online_ponto: log parameters should be a single dict --- .../online_bank_statement_provider_ponto.py | 8 +++++--- .../models/ponto_interface.py | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/account_statement_import_online_ponto/models/online_bank_statement_provider_ponto.py b/account_statement_import_online_ponto/models/online_bank_statement_provider_ponto.py index 8007c4b75b..5750dcf418 100644 --- a/account_statement_import_online_ponto/models/online_bank_statement_provider_ponto.py +++ b/account_statement_import_online_ponto/models/online_bank_statement_provider_ponto.py @@ -67,9 +67,11 @@ def _ponto_pull(self, date_since, date_until): "Ponto obtain statement data for journal {journal}" " from {date_since} to {date_until}" ), - journal=self.journal_id.name, - date_since=date_since, - date_until=date_until, + dict( + journal=self.journal_id.name, + date_since=date_since, + date_until=date_until, + ), ) else: _logger.debug( diff --git a/account_statement_import_online_ponto/models/ponto_interface.py b/account_statement_import_online_ponto/models/ponto_interface.py index 28fb7890bb..e811749eb4 100644 --- a/account_statement_import_online_ponto/models/ponto_interface.py +++ b/account_statement_import_online_ponto/models/ponto_interface.py @@ -35,7 +35,7 @@ def _login(self, username, password): "Accept": "application/json", "Authorization": "Basic {login}".format(login=login), } - _logger.debug(_("POST request on {url}"), url=url) + _logger.debug(_("POST request on {url}"), dict(url=url)) response = requests.post( url, params={"grant_type": "client_credentials"}, @@ -71,7 +71,7 @@ def _get_request_headers(self, access_data): def _set_access_account(self, access_data, account_number): """Set ponto account for bank account in access_data.""" url = PONTO_ENDPOINT + "/accounts" - _logger.debug(_("GET request on {}"), url) + _logger.debug(_("GET request on {url}"), dict(url=url)) response = requests.get( url, params={"limit": 100}, @@ -119,8 +119,8 @@ def _get_transactions_from_data(self, data): transactions = data.get("data", []) if not transactions: _logger.debug( - _("No transactions where found in data {}"), - data, + _("No transactions where found in data {data}"), + dict(data=data), ) else: _logger.debug( @@ -134,9 +134,11 @@ def _get_request(self, access_data, url, params): headers = self._get_request_headers(access_data) _logger.debug( _("GET request to {url} with headers {headers} and params {params}"), - url=url, - headers=headers, - params=params, + dict( + url=url, + headers=headers, + params=params, + ), ) response = requests.get( url, @@ -150,7 +152,7 @@ def _get_response_data(self, response): """Get response data for GET or POST request.""" _logger.debug( _("HTTP answer code {response_code} from Ponto"), - response_code=response.status_code, + dict(response_code=response.status_code), ) if response.status_code not in (200, 201): raise UserError(