Skip to content

Commit

Permalink
Merge pull request #37 from Cobliteam/ll-fix_ssl_error
Browse files Browse the repository at this point in the history
Fix SSL Error
  • Loading branch information
lsflp authored Jun 21, 2023
2 parents 1901b93 + 8caa025 commit 75b8baf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions hubspot3/deals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions hubspot3/engagements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion hubspot3/tickets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit 75b8baf

Please sign in to comment.