1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-04 01:21:03 +03:00

log more contextual data if possible on a 413

This commit is contained in:
A_D 2022-01-26 19:05:00 +02:00
parent e6ffe7e520
commit e891ee4da0
No known key found for this signature in database
GPG Key ID: 4BE9EB7DF45076C4

View File

@ -6,6 +6,7 @@ import pathlib
import re import re
import sys import sys
import tkinter as tk import tkinter as tk
from base64 import encode
from collections import OrderedDict from collections import OrderedDict
from os import SEEK_SET from os import SEEK_SET
from os.path import join from os.path import join
@ -246,7 +247,15 @@ class EDDN:
return # We want to silence warnings otherwise return # We want to silence warnings otherwise
if r.status_code == 413: if r.status_code == 413:
self._log_response(r, header_msg='Got a 413 while POSTing data', sent_data_len=str(len(encoded))) extra_data = {
'schema_ref': msg.get('$schemaRef', 'Unset $schemaRef!'),
'sent_data_len': str(len(encoded)),
}
if '/journal/' in extra_data['schema_ref']:
extra_data['event'] = msg.get('message', {}).get('event', 'No Event Set')
self._log_response(r, header_msg='Got a 413 while POSTing data', **extra_data)
return # drop the error return # drop the error
if not self.UNKNOWN_SCHEMA_RE.match(r.text): if not self.UNKNOWN_SCHEMA_RE.match(r.text):