eric-maynard commented on code in PR #2154:
URL: https://github.com/apache/polaris/pull/2154#discussion_r2223150544
##########
client/python/cli/polaris_cli.py:
##########
@@ -77,6 +81,26 @@ def execute(args=None):
PolarisCli._try_print_exception(e)
sys.exit(1)
+ @staticmethod
+ def _enable_api_request_logging():
+ # Store the original urlopen method
+ if not hasattr(urllib3.PoolManager, "original_urlopen"):
+ urllib3.PoolManager.original_urlopen = urllib3.PoolManager.urlopen
+
+ # Define the wrapper function
+ @functools.wraps(urllib3.PoolManager.original_urlopen)
+ def urlopen_wrapper(self, method, url, **kwargs):
+ print(f"Request: {method} {url}")
+ if "headers" in kwargs:
+ print(f"Headers: {kwargs['headers']}")
Review Comment:
Does it make sense to use STDERR so you can still handle stdout if need be?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]