From beb9b4492275c501e8e612f5c342d8a4db875783 Mon Sep 17 00:00:00 2001 From: James Knight Date: Sun, 17 Mar 2024 20:12:01 -0400 Subject: [PATCH] rest: flush header debug prints When dumping header debug prints to standard output, flush this output to prevent standard error events from making the resulting output hard to interpret. Signed-off-by: James Knight --- sphinxcontrib/confluencebuilder/rest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinxcontrib/confluencebuilder/rest.py b/sphinxcontrib/confluencebuilder/rest.py index db3e6bc5..bda45903 100644 --- a/sphinxcontrib/confluencebuilder/rest.py +++ b/sphinxcontrib/confluencebuilder/rest.py @@ -341,7 +341,7 @@ def _process_request(self, method, path, *args, **kwargs): print('(debug) Request]') print(f'{req.method} {req.url}') print('\n'.join(f'{k}: {v}' for k, v in req.headers.items())) - print('') + print('', flush=True) # perform the rest request rsp = self.session.send(req, timeout=self.timeout) @@ -351,7 +351,7 @@ def _process_request(self, method, path, *args, **kwargs): print('(debug) Response]') print(f'Code: {rsp.status_code}') print('\n'.join(f'{k}: {v}' for k, v in rsp.headers.items())) - print('') + print('', flush=True) # if confluence or a proxy reports a retry-after delay (to pace us), # track it to delay the next request made