diff --git a/freenlpc/freenlpc.py b/freenlpc/freenlpc.py index a1fb8f7..c6685a8 100644 --- a/freenlpc/freenlpc.py +++ b/freenlpc/freenlpc.py @@ -40,8 +40,10 @@ def __check_keys(self): try: nlpcloud.Client(self.which_model("sentiment_pos_neg"), self.__api_keys[i], lang="en").sentiment("i hate physics") - except requests.exceptions.HTTPError: - raise Exception(f"API Token at index {i} is not valid.") + except requests.exceptions.HTTPError as e: + if str(e).find("Unauthorized") != -1: + raise Exception( + f"API Token at index {i} is not valid.") def which_model(self, task_name): """which model is being used for a specific task. diff --git a/setup.py b/setup.py index d6574df..c0f9071 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = '0.1.6' +VERSION = '0.1.7' DESCRIPTION = 'A wrapper for nlpcloud free-tier services with no requests per minute limits.' LONG_DESCRIPTION = """# freenlpc a wrapper for nlpcloud free-tier.