eric-maynard commented on code in PR #2154:
URL: https://github.com/apache/polaris/pull/2154#discussion_r2242442378


##########
client/python/cli/polaris_cli.py:
##########
@@ -72,11 +74,33 @@ def execute(args=None):
 
                     admin_api = PolarisDefaultApi(api_client)
                     command = Command.from_options(options)
+                    if options.debug:
+                        PolarisCli._enable_api_request_logging()
                     command.execute(admin_api)
                 except Exception as e:
                     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):
+            sys.stderr.write(f"Request: {method} {url}\n")

Review Comment:
   I don't know if there's a standard format for this kind of thing -- what you 
have looks good to me though. If we were taking the dry-run approach, it might 
be nice to print a runnable command like a curl.



-- 
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: issues-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to