From 31d356ea49e1973452a01bd23a5fb2bad5a08e01 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 12 May 2019 10:06:26 +0200 Subject: [PATCH] Tweak the trash --- app.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/app.py b/app.py index ee9507b..e7c98e6 100644 --- a/app.py +++ b/app.py @@ -1756,11 +1756,7 @@ def inbox(): return Response( status=422, headers={"Content-Type": "application/json"}, - response=json.dumps( - { - "error": "failed to decode request as JSON" - } - ), + response=json.dumps({"error": "failed to decode request as JSON"}), ) print(f"req_headers={request.headers}") @@ -1789,20 +1785,23 @@ def inbox(): return Response(status=201) except Exception: - logger.exception(f'failed to fetch remote for payload {data!r}') + logger.exception(f"failed to fetch remote for payload {data!r}") # Track/store the payload for analysis ip, geoip = _get_ip() - DB.trash.insert({ - "activity": data, - "meta": { - "ts": datetime.now().timestamp(), - "ip_address": ip, - "geoip": geoip, - "tb": traceback.format_exc(), - }, - }) + DB.trash.insert( + { + "activity": data, + "meta": { + "ts": datetime.now().timestamp(), + "ip_address": ip, + "geoip": geoip, + "tb": traceback.format_exc(), + "headers": dict(request.headers), + }, + } + ) return Response( status=422,