From 25f941a66ed79f730f6dbf6a7f5515e1057fbcc4 Mon Sep 17 00:00:00 2001 From: Prratek Ramchandani Date: Wed, 8 Nov 2023 14:21:32 -0500 Subject: [PATCH] handle decode error --- .gitignore | 3 +++ tap_rakuten/client.py | 15 ++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 510c73d..949ad11 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,6 @@ dmypy.json # Pyre type checker .pyre/ + +#JetBrains +.idea/ diff --git a/tap_rakuten/client.py b/tap_rakuten/client.py index 75839fd..698f7d9 100644 --- a/tap_rakuten/client.py +++ b/tap_rakuten/client.py @@ -395,11 +395,16 @@ def report(self, report_slug, start_date, **kwargs): )) with self.get(report_slug, start_date=start_date, **kwargs) as r: - reader = csv.DictReader( - r.iter_lines(decode_unicode=True), - delimiter=',', - quotechar='"' - ) + try: + reader = csv.DictReader( + r.iter_lines(decode_unicode=True), + delimiter=',', + quotechar='"' + ) + except requests.exceptions.ChunkedEncodingError as e: + logger.error( + f"Skipping {report_slug} for {start_date} due to error: {e}" + ) logger.info('{} : processing CSV data.'.format( report_slug ))