Skip to content

Commit

Permalink
[FIX] *_online_ponto: log parameters should be a single dict
Browse files Browse the repository at this point in the history
  • Loading branch information
NL66278 committed Mar 16, 2023
1 parent 34a92dc commit 6ac2db2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
18 changes: 10 additions & 8 deletions account_statement_import_online_ponto/models/ponto_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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(
Expand All @@ -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,
Expand All @@ -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(
Expand Down

0 comments on commit 6ac2db2

Please sign in to comment.