From 34e0e0543bbe7edeae6575d103fa6715e76694d9 Mon Sep 17 00:00:00 2001 From: Hunter Kuffel Date: Wed, 12 Apr 2023 11:40:33 -0700 Subject: [PATCH] add source_signup error handling --- tap_sailthru/streams.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tap_sailthru/streams.py b/tap_sailthru/streams.py index c9b68d0..a535023 100644 --- a/tap_sailthru/streams.py +++ b/tap_sailthru/streams.py @@ -634,9 +634,12 @@ def post_process(self, row: dict, context: Optional[dict]) -> dict: if "source_signup_count" in keys_arr: source_signup_count_dict = row.copy()["source_signup_count"] new_source_signup_count_arr = [] - for k, v in source_signup_count_dict.items(): - new_source_signup_count_arr.append({"source": k, "count": v}) - row["source_signup_count"] = new_source_signup_count_arr + try: + for k, v in source_signup_count_dict.items(): + new_source_signup_count_arr.append({"source": k, "count": v}) + row["source_signup_count"] = new_source_signup_count_arr + except AttributeError: + row["source_signup_count"] = [] return row