diff --git a/blizzardapi/api.py b/blizzardapi/api.py index f12cbe5..80f3994 100644 --- a/blizzardapi/api.py +++ b/blizzardapi/api.py @@ -1,7 +1,10 @@ import requests from requests.exceptions import RequestException -from .exceptions import BlizzardApiRequestException +from .exceptions import ( + BlizzardApiRequestException, + BlizzardApiResponseExeception, +) class Api: @@ -34,16 +37,10 @@ def _get_client_token(self, region): return self._response_handler(response) def _response_handler(self, response): - if not response.ok: - msg = ( - f"Invalid response - {response.status_code} for {response.url}" - ) - raise BlizzardApiRequestException(msg) - try: json = response.json() except Exception as e: - raise BlizzardApiRequestException(str(e)) + raise BlizzardApiResponseExeception(str(e)) return json diff --git a/blizzardapi/exceptions.py b/blizzardapi/exceptions.py index 9c88c6a..09d9a75 100644 --- a/blizzardapi/exceptions.py +++ b/blizzardapi/exceptions.py @@ -4,3 +4,7 @@ class BlizzardApiException(Exception): class BlizzardApiRequestException(BlizzardApiException): pass + + +class BlizzardApiResponseExeception(BlizzardApiException): + pass diff --git a/setup.py b/setup.py index 63c719a..3411a91 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ import setuptools -__version__ = "1.1.1" +__version__ = "1.1.2" with open("README.md", "r") as fh: long_description = fh.read() @@ -21,14 +21,21 @@ url="https://github.com/trevorphillips/python-blizzardapi", packages=setuptools.find_packages(), install_requires=install_requirements, + python_requires=">=3.6", classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", + "Topic :: Internet", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: Libraries", + "Topic :: Utilities", ], - python_requires=">=3.6", )