How to use the hubspot3.error.HubspotBadConfig function in hubspot3

To help you get started, we’ve selected a few hubspot3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jpetrucciani / hubspot3 / hubspot3 / ecommerce_bridge.py View on Github external
object_type: str = None,
        limit: int = None,
        starting_page: int = None,
        **options
    ) -> List:
        """
        Retrieve a list of error dictionaries for the app with the given ID, optionally
        filtered/limited, and ordered by recency.

        This method and the endpoint it calls can only be used with the developer API key of the
        developer portal that created the app.

        :see: https://developers.hubspot.com/docs/methods/ecommerce/v2/get-all-sync-errors-for-an-app # noqa
        """
        if not self.api_key:
            raise HubspotBadConfig(
                "The portal-independent sync errors for an app can only be "
                "retrieved using the corresponding developer API key."
            )
        return self._get_sync_errors(
            "sync/errors/app/{app_id}".format(app_id=app_id),
            include_resolved=include_resolved,
            error_type=error_type,
            object_type=object_type,
            limit=limit,
            starting_page=starting_page,
            **options
        )
github jpetrucciani / hubspot3 / hubspot3 / base.py View on Github external
if not mixins:
            mixins = []
        mixins.reverse()
        for mixin_class in mixins:
            if mixin_class not in self.__class__.__bases__:
                self.__class__.__bases__ = (mixin_class,) + self.__class__.__bases__

        self.api_key = api_key
        self.access_token = access_token
        self.refresh_token = refresh_token
        self.client_id = client_id
        self.client_secret = client_secret
        self.log = utils.get_log("hubspot3")
        if not disable_auth:
            if self.api_key and self.access_token:
                raise HubspotBadConfig("Cannot use both api_key and access_token.")
            if not (self.api_key or self.access_token or self.refresh_token):
                raise HubspotNoConfig("Missing required credentials.")
        self.options = {
            "api_base": api_base,
            "debug": debug,
            "disable_auth": disable_auth,
            "timeout": timeout,
        }
        self.options.update(extra_options)
        self._prepare_connection_type()
github jpetrucciani / hubspot3 / hubspot3 / ecommerce_bridge.py View on Github external
object_type: str = None,
        limit: int = None,
        starting_page: int = None,
        **options
    ):
        """
        Retrieve a list of error dictionaries for an app in specific portal, optionally
        filtered/limited, and ordered by recency.

        This method and the endpoint it calls can only be used with OAuth tokens and both the app
        and the portal are determined from the tokens used.

        :see: https://developers.hubspot.com/docs/methods/ecommerce/v2/get-all-sync-errors-for-an-app-and-account # noqa
        """
        if not self.access_token:
            raise HubspotBadConfig(
                "The sync errors for a specific account from a specific app "
                "can only be retrieved using an access token."
            )
        return self._get_sync_errors(
            "sync/errors",
            include_resolved=include_resolved,
            error_type=error_type,
            object_type=object_type,
            limit=limit,
            starting_page=starting_page,
            **options
        )
github jpetrucciani / hubspot3 / hubspot3 / __init__.py View on Github external
client_secret: str = None,
        timeout: int = 10,
        api_base: str = "api.hubapi.com",
        debug: bool = False,
        disable_auth: bool = False,
        **extra_options: Any
    ) -> None:
        """full client constructor"""
        self.api_key = api_key
        self.access_token = access_token
        self.refresh_token = refresh_token
        self.client_id = client_id
        self.client_secret = client_secret
        if not disable_auth:
            if self.api_key and self.access_token:
                raise HubspotBadConfig("Cannot use both api_key and access_token.")
            if not (self.api_key or self.access_token or self.refresh_token):
                raise HubspotNoConfig("Missing required credentials.")
        self.auth = {
            "access_token": self.access_token,
            "api_key": self.api_key,
            "client_id": self.client_id,
            "client_secret": self.client_secret,
            "refresh_token": self.refresh_token,
        }
        self.options = {
            "api_base": api_base,
            "debug": debug,
            "disable_auth": disable_auth,
            "timeout": timeout,
        }
        self.options.update(extra_options)
github jpetrucciani / hubspot3 / hubspot3 / ecommerce_bridge.py View on Github external
object_type: str = None,
        limit: int = None,
        starting_page: int = None,
        **options
    ) -> List:
        """
        Retrieve a list of error dictionaries for an account, optionally filtered/limited, and
        ordered by recency.

        This method and the endpoint it calls can only be used with a portal API key and the portal
        is determined from that key.

        :see: https://developers.hubspot.com/docs/methods/ecommerce/v2/get-all-sync-errors-for-a-specific-account # noqa
        """
        if not self.api_key:
            raise HubspotBadConfig(
                "The app-independent sync errors for a specific account can "
                "only be retrieved using the corresponding portal API key."
            )
        return self._get_sync_errors(
            "sync/errors/portal",
            include_resolved=include_resolved,
            error_type=error_type,
            object_type=object_type,
            limit=limit,
            starting_page=starting_page,
            **options
        )