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))