diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2024-02-11 07:52:32 -0700 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2024-02-11 07:52:40 -0700 |
commit | 4632f8bc1e0318dd9d5057828a2fd8c851efb858 (patch) | |
tree | 77907fc0c8803de8a7c9a5b017f53bd57e30b013 /api-magic/stdout_filterer.py | |
parent | 4a2577004e9c9600be06ecd9cbe3f81685f6bfe9 (diff) |
more
Diffstat (limited to 'api-magic/stdout_filterer.py')
-rw-r--r-- | api-magic/stdout_filterer.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/api-magic/stdout_filterer.py b/api-magic/stdout_filterer.py new file mode 100644 index 0000000..2d6a6f6 --- /dev/null +++ b/api-magic/stdout_filterer.py @@ -0,0 +1,15 @@ +import re + + +class RedactPhoneNumbers: + def __init__(self, stream): + self.stream = stream + + def write(self, text): + # Regular expression to match phone numbers + #phone_regex = r"(\+\d{1,2}\s?)?1?\-?\.?\s?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}" + #redacted_text = re.sub(phone_regex, "****", text) + self.stream.write(text) + + def flush(self): + self.stream.flush()
\ No newline at end of file |