From 3e6d140726595739091cdcf14457f7a4f862b456 Mon Sep 17 00:00:00 2001 From: Vinicius Mesel Date: Mon, 13 Nov 2023 14:34:05 -0300 Subject: [PATCH] Adds fallback on missing scopes error during schema discovery (#8) --- tap_hubspot_beta/streams.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tap_hubspot_beta/streams.py b/tap_hubspot_beta/streams.py index 06a972c..7e23d58 100644 --- a/tap_hubspot_beta/streams.py +++ b/tap_hubspot_beta/streams.py @@ -5,6 +5,7 @@ from singer_sdk.exceptions import InvalidStreamSortException from singer_sdk.helpers.jsonpath import extract_jsonpath +from singer_sdk.exceptions import FatalAPIError import requests from backports.cached_property import cached_property @@ -647,7 +648,11 @@ def schema(self) -> dict: # Init request session self._requests_session = requests.Session() # Get the data from Hubspot - records = self.request_records(dict()) + try: + records = self.request_records(dict()) + except FatalAPIError: + self.logger.warning("Failed to run discover on dynamic stream ContactListsStream properties.") + records = [] properties = [] property_names = set() @@ -1158,4 +1163,4 @@ class AssociationQuotesDealsStream(AssociationDealsStream): """Association Quotes -> Deals Stream""" name = "associations_quotes_deals" - path = "crm/v4/associations/deals/quotes/batch/read" \ No newline at end of file + path = "crm/v4/associations/deals/quotes/batch/read"