Вывод HTTP ответов при отладке
This commit is contained in:
parent
8be3fc137a
commit
b55cb01fba
1 changed files with 3 additions and 1 deletions
4
main.py
4
main.py
|
|
@ -245,8 +245,10 @@ if __name__ == '__main__':
|
||||||
logging.basicConfig(format='%(levelname)s -> %(message)s', level=args.log_level.upper())
|
logging.basicConfig(format='%(levelname)s -> %(message)s', level=args.log_level.upper())
|
||||||
|
|
||||||
def response_hook(resp, *_args, **_kwargs):
|
def response_hook(resp, *_args, **_kwargs):
|
||||||
|
if logging.root.isEnabledFor(logging.DEBUG):
|
||||||
|
if 'application/json' in resp.headers['Content-Type']:
|
||||||
|
logging.debug(resp.text)
|
||||||
time.sleep(args.delay)
|
time.sleep(args.delay)
|
||||||
pass
|
|
||||||
|
|
||||||
session = Session()
|
session = Session()
|
||||||
session.hooks = {'response': response_hook}
|
session.hooks = {'response': response_hook}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue