X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=store.py;h=67e8a8fad7f9ce3698095914351eb4602fe7564d;hb=882d55e99489d9131b5171f23e505b0dfd1c8738;hp=2b5c18a1a1a65eb241af2677d322195a5202d18d;hpb=90d7423eec074a0ed0af680c223180f8d7e1d4e6;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git diff --git a/store.py b/store.py index 2b5c18a..67e8a8f 100644 --- a/store.py +++ b/store.py @@ -176,15 +176,28 @@ class ReportStore: }) def log_http_request(self, method, url, body, headers, response): - self.add_log({ - "type": "http_request", - "method": method, - "url": url, - "body": body, - "headers": headers, - "status": response.status_code, - "response": response.text - }) + if isinstance(response, Exception): + self.add_log({ + "type": "http_request", + "method": method, + "url": url, + "body": body, + "headers": headers, + "status": -1, + "response": None, + "error": response.__class__.__name__, + "error_message": str(response), + }) + else: + self.add_log({ + "type": "http_request", + "method": method, + "url": url, + "body": body, + "headers": headers, + "status": response.status_code, + "response": response.text + }) def log_error(self, action, message=None, exception=None): self.print_log("[Error] {}".format(action)) @@ -209,15 +222,13 @@ class ReportStore: "action": action, }) - def log_market(self, args, user_id, market_id, report_path, debug): + def log_market(self, args, user_id, market_id): self.add_log({ "type": "market", "commit": "$Format:%H$", "args": vars(args), "user_id": user_id, "market_id": market_id, - "report_path": report_path, - "debug": debug, }) class BalanceStore: