Skip to content

Commit

Permalink
added http_debug arg
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyaven committed Nov 19, 2024
1 parent e4058ae commit 9ac0fa8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 9 additions & 0 deletions pystackql/stackql.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ def __init__(self,
page_limit=20,
max_depth=5,
debug=False,
http_debug=False,
debug_log_file=None):
"""Constructor method
"""
Expand All @@ -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')
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -624,6 +630,9 @@ def execute(self, query, suppress_errors=True, custom_auth=None, env_vars=None):
# [{'error': <error json str>}] if something went wrong; or
# [{<row1>},...] 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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 9ac0fa8

Please sign in to comment.