From 9ac0fa8d07fa45d027d3a7908064bf9d9706f949 Mon Sep 17 00:00:00 2001 From: Jeffrey Aven Date: Tue, 19 Nov 2024 13:34:39 +1100 Subject: [PATCH] added http_debug arg --- CHANGELOG.md | 6 ++++++ LICENSE | 2 +- pystackql/stackql.py | 9 +++++++++ setup.py | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aecbd4..ee77f3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v3.7.1 (2024-11-19) + +### Updates + +- Added `http_debug` constructor argument to return HTTP log information + ## v3.7.0 (2024-11-08) ### Updates diff --git a/LICENSE b/LICENSE index 81436d1..f0e0b3c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 StackQL Studios +Copyright (c) 2022-2025 StackQL Studios Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/pystackql/stackql.py b/pystackql/stackql.py index d499524..7c572d1 100644 --- a/pystackql/stackql.py +++ b/pystackql/stackql.py @@ -297,6 +297,7 @@ def __init__(self, page_limit=20, max_depth=5, debug=False, + http_debug=False, debug_log_file=None): """Constructor method """ @@ -315,6 +316,7 @@ def __init__(self, raise ValueError("CSV output is not supported in server mode, use 'dict' or 'pandas' instead.") self.debug = debug + if debug: if debug_log_file is None: self.debug_log_file = os.path.join(os.path.expanduser("~"), '.pystackql', 'debug.log') @@ -442,6 +444,10 @@ def __init__(self, self.params.append("--apirequesttimeout") self.params.append(str(api_timeout)) + if http_debug: + self.http_debug = http_debug + self.params.append("--http.log.enabled") + # proxy settings if proxy_host is not None: self.proxy_host = proxy_host @@ -624,6 +630,9 @@ def execute(self, query, suppress_errors=True, custom_auth=None, env_vars=None): # [{'error': }] if something went wrong; or # [{},...] if the statement was executed successfully, messages to stderr + if self.http_debug: + suppress_errors = False + output = self._run_query(query, custom_auth=custom_auth, env_vars=env_vars) if "exception" in output: diff --git a/setup.py b/setup.py index bc77aff..8ebc3b1 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name='pystackql', - version='v3.7.0', + version='v3.7.1', description='A Python interface for StackQL', long_description=readme, author='Jeffrey Aven',