diff --git a/hubspot3/deals.py b/hubspot3/deals.py index 09d100b..181db69 100644 --- a/hubspot3/deals.py +++ b/hubspot3/deals.py @@ -160,7 +160,8 @@ def get_all_as_generator( offset = batch["offset"] yield from deals - except ConnectionResetError: + except (ConnectionResetError, Exception) as e: + logging.warn(e) tries += 1 logging.info(f"###### TENTATIVA NUMERO: {tries}") logging.info(f"###### total_deals: {deal_counter}") @@ -302,7 +303,8 @@ def get_recently_modified_in_interval( deals = clean_result("deals", deals, start_date, end_date) yield from deals - except ConnectionResetError: + except (ConnectionResetError, Exception) as e: + logging.warn(e) tries += 1 logging.info(f"###### TENTATIVA NUMERO: {tries}") sleep(120) diff --git a/hubspot3/engagements.py b/hubspot3/engagements.py index a006f00..43ebe6b 100644 --- a/hubspot3/engagements.py +++ b/hubspot3/engagements.py @@ -103,7 +103,8 @@ def get_all_as_generator(self, limit=-1, **options): offset = batch["offset"] yield from engagements - except ConnectionResetError: + except (ConnectionResetError, Exception) as e: + logging.warn(e) tries += 1 logging.info(f"###### TENTATIVA NUMERO: {tries}") logging.info(f"###### total_engagements: {engagement_counter}") @@ -130,7 +131,8 @@ def get_recently_modified(self, start_date: int, end_date: int, **options): engagements = clean_result("engagements", engagements, start_date, end_date) yield from engagements - except ConnectionResetError: + except (ConnectionResetError, Exception) as e: + logging.warn(e) tries += 1 logging.info(f"###### TENTATIVA NUMERO: {tries}") sleep(120) diff --git a/hubspot3/tickets.py b/hubspot3/tickets.py index 10fbe5d..252fe3a 100644 --- a/hubspot3/tickets.py +++ b/hubspot3/tickets.py @@ -137,7 +137,8 @@ def get_all_as_generator(self, limit: int = -1, extra_properties: Union[List[str if reached_limit: outputs = outputs[:limit] yield from outputs - except ConnectionResetError: + except (ConnectionResetError, Exception) as e: + logging.warn(e) tries += 1 logging.info(f"###### TENTATIVA NUMERO: {tries}") logging.info(f"###### total_tickets: {total_tickets}")