diff --git a/deepomatic/api/exceptions.py b/deepomatic/api/exceptions.py index 6470c98..97df5e4 100644 --- a/deepomatic/api/exceptions.py +++ b/deepomatic/api/exceptions.py @@ -32,6 +32,12 @@ class DeepomaticException(Exception): def __init__(self, msg): super(DeepomaticException, self).__init__(msg) +############################################################################### + + +class CredentialsNotFound(DeepomaticException): + pass + ############################################################################### diff --git a/deepomatic/api/http_helper.py b/deepomatic/api/http_helper.py index ba055f3..beb2656 100644 --- a/deepomatic/api/http_helper.py +++ b/deepomatic/api/http_helper.py @@ -30,7 +30,8 @@ import requests from deepomatic.api.exceptions import (BadStatus, ServerError, - ClientError, DeepomaticException) + ClientError, DeepomaticException, + CredentialsNotFound) from deepomatic.api.http_retry import HTTPRetry from deepomatic.api.version import __title__, __version__ from requests.structures import CaseInsensitiveDict @@ -76,7 +77,7 @@ def __init__(self, app_id=None, api_key=None, verify_ssl=None, if api_key is None: api_key = os.getenv('DEEPOMATIC_API_KEY') if api_key is None: - raise DeepomaticException("Please specify 'api_key' either by passing it to the client" + raise CredentialsNotFound("Please specify 'api_key' either by passing it to the client" " or by defining the DEEPOMATIC_API_KEY environment variable.") if version is None or version == '':