Mentions légales du service

Skip to content
Snippets Groups Projects
Commit e3a2222d authored by Sebastien Letort's avatar Sebastien Letort
Browse files

better string formatting in log.

parent ce28e342
No related branches found
No related tags found
Loading
Pipeline #117612 passed
...@@ -200,8 +200,8 @@ class Client: ...@@ -200,8 +200,8 @@ class Client:
""" """
headers = {'Authorization': 'Token token={}'.format(self.token)} headers = {'Authorization': 'Token token={}'.format(self.token)}
url = '{}/api/v1/{}'.format(self.allgo_url, url_end) url = '{}/api/v1/{}'.format(self.allgo_url, url_end)
logging.debug("querying '{}' with method '{}'".format(url, method)) logging.debug("querying '%s' with method '%s'", str(url), str(method))
logging.debug("and with data = {}".format(kwargs)) logging.debug("and with data = %s", str(kwargs))
actions = { actions = {
'post': requests.post, 'post': requests.post,
...@@ -209,9 +209,9 @@ class Client: ...@@ -209,9 +209,9 @@ class Client:
} }
try: try:
resp = actions[method](url, headers=headers, verify=self.verify_tls, **kwargs) resp = actions[method](url, headers=headers, verify=self.verify_tls, **kwargs)
logging.debug("raw API answer : {}".format(resp.content)) logging.debug("raw API answer : %s", str(resp.content))
if resp.status_code != requests.codes.ok: if resp.status_code != requests.codes.ok:
logging.debug("req.status_code = {}".format(resp.status_code)) logging.debug("req.status_code = %s", str(resp.status_code))
raise StatusError(resp.status_code, resp) raise StatusError(resp.status_code, resp)
return resp.json() return resp.json()
except ValueError: # pure python3 should use JSONDecodeError except ValueError: # pure python3 should use JSONDecodeError
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment