Skip to content

added http_debug arg #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
11 changes: 11 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,12 @@ def __init__(self,
self.params.append("--apirequesttimeout")
self.params.append(str(api_timeout))

if http_debug:
self.http_debug = True
self.params.append("--http.log.enabled")
else:
self.http_debug = False

# proxy settings
if proxy_host is not None:
self.proxy_host = proxy_host
Expand Down Expand Up @@ -624,6 +632,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