diff options
| author | Alex Schofield <git@ajschof.me> | 2025-02-26 15:23:47 +0000 |
|---|---|---|
| committer | Alex Schofield <git@ajschof.me> | 2025-02-26 15:23:47 +0000 |
| commit | e8788272eda9c2ab74fa6ee1a2cc260ed7e87e76 (patch) | |
| tree | 5d8ef32d2a1e4467e000a7ccac1416b16fa91fd5 /gdpr_obfuscator | |
| parent | 202bc5c82f446c514c9673f51ff5c0bf9a410cca (diff) | |
| download | gdpr-obfuscator-e8788272eda9c2ab74fa6ee1a2cc260ed7e87e76.tar.gz gdpr-obfuscator-e8788272eda9c2ab74fa6ee1a2cc260ed7e87e76.zip | |
add function to read json input
Diffstat (limited to 'gdpr_obfuscator')
| -rw-r--r-- | gdpr_obfuscator/utils.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gdpr_obfuscator/utils.py b/gdpr_obfuscator/utils.py index 9736d7c..656b084 100644 --- a/gdpr_obfuscator/utils.py +++ b/gdpr_obfuscator/utils.py @@ -2,11 +2,20 @@ import csv import io from enum import Enum from typing import List, Dict +import json class Utilities: - def __init__(self, logger=None): - pass + + def process_json_input(json_input: str): + data = json.loads(json_input) + + if not data.get("file_path") or not data.get("pii_fields"): + raise ValueError( + "Missing required file_path & pii_fields entries in JSON input" + ) + + return data["file_path"], data["pii_fields"] @staticmethod def get_s3_path(uri): |
