From 529c198ad31ae9e1c17a6c842857b48b46e1237a Mon Sep 17 00:00:00 2001 From: Nathan Moore Date: Tue, 28 Nov 2023 15:15:42 -0500 Subject: [PATCH] Fix export subject alteration (#62) * Subject Alteration had a bad concat that was throwing an error * removing logs --- qualtrix/client.py | 3 +-- qualtrix/settings.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/qualtrix/client.py b/qualtrix/client.py index 21c8d26..2d5be13 100644 --- a/qualtrix/client.py +++ b/qualtrix/client.py @@ -158,8 +158,7 @@ def get_answer_from_result(result): "fake_id_type": labels.get("QID12", None), "spoof_artifact_type": labels.get("QID13", None), "document_type": labels.get("QID15", None), - "subject_alterations": labels.get("QID17", "") - + values.get("QID17_TEXT", ""), + "subject_alterations": labels.get("QID17", None), "mask_type": labels.get("QID18", "") + values.get("QID18_4_TEXT", ""), } else: diff --git a/qualtrix/settings.py b/qualtrix/settings.py index e9ef037..e3a124c 100644 --- a/qualtrix/settings.py +++ b/qualtrix/settings.py @@ -16,6 +16,8 @@ LOG_LEVEL = os.getenv("LOG_LEVEL", logging.getLevelName(logging.INFO)) API_TOKEN = None +BASE_URL = None +DIRECTORY_ID = None try: vcap_services = os.getenv("VCAP_SERVICES") @@ -27,9 +29,15 @@ log.info("Loading credentials from env var") config = service["credentials"] break - API_TOKEN = config["api_token"] - BASE_URL = config["base_url"] - DIRECTORY_ID = config["directory_id"] + API_TOKEN = config["api_token"] + BASE_URL = config["base_url"] + DIRECTORY_ID = config["directory_id"] + else: + API_TOKEN = os.getenv("QX_API_TOKEN") + BASE_URL = os.getenv("QX_BASE_URL") + DIRECTORY_ID = os.getenv("QX_DIRECTORY_ID") + + except (json.JSONDecodeError, KeyError, FileNotFoundError) as err: log.warning("Unable to load credentials from VCAP_SERVICES") log.debug("Error: %s", str(err))