From e0a67cfbe3dadf32e99957f1612a4bc85938870c Mon Sep 17 00:00:00 2001 From: David McKee Date: Wed, 6 Nov 2024 16:32:26 +0000 Subject: [PATCH] Add DEBUG logging --- src/caselawclient/Client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/caselawclient/Client.py b/src/caselawclient/Client.py index 85bbe3c2..4141c650 100644 --- a/src/caselawclient/Client.py +++ b/src/caselawclient/Client.py @@ -62,6 +62,8 @@ VERSION = "0" DEFAULT_USER_AGENT = f"ds-caselaw-marklogic-api-client/{VERSION}" +DEBUG: bool = bool(os.getenv("DEBUG", default=False)) + class NoResponse(Exception): """A requests HTTPError has no response. We expect this will never happen.""" @@ -728,6 +730,10 @@ def eval( "vars": vars, } path = "LATEST/eval" + + if DEBUG: + print(f"Sending {vars} to {xquery_path}") + response = self.session.request( "POST", url=self._path_to_request_url(path),