From 93988054af0f45f6c65fc6a1ef97757c760d654d Mon Sep 17 00:00:00 2001 From: Jesse Vickery <97247789+JVickery-TBS@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:06:11 -0500 Subject: [PATCH] fdtester - Catch possible no environ. --- ckanext/api_tracking/interfaces.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ckanext/api_tracking/interfaces.py b/ckanext/api_tracking/interfaces.py index c9a1e31..db01b0d 100644 --- a/ckanext/api_tracking/interfaces.py +++ b/ckanext/api_tracking/interfaces.py @@ -31,7 +31,10 @@ def track_usage(self, data, api_token): # we can do something with the data after it has been tracked data = item.before_track_usage(data) - environ = data.pop('environ') + environ = data.pop('environ', None) + if not environ: + log.warning('No environment initialized for request. Unable to track') + return ckan_url = CKANURL(environ) method = ckan_url.method.lower() tracking_type = data['tracking_type']