Вывод xml-ответов при использовании loglevel.DEBUG

This commit is contained in:
Lev Plyusnin 2023-06-07 08:23:48 +07:00
parent 4e9bdf4de7
commit a79911619f
No known key found for this signature in database
GPG key ID: 21C6C2C9C0A4460D

View file

@ -394,7 +394,8 @@ if __name__ == '__main__':
def response_hook(resp, *_args, **_kwargs):
if logging.root.isEnabledFor(logging.DEBUG):
if 'application/json' in resp.headers['Content-Type']:
target_headers = ['application/json', 'text/xml']
if any(h in resp.headers['Content-Type'] for h in target_headers):
logging.debug(resp.text)
time.sleep(args.delay)