diff --git a/foobot_async/__init__.py b/foobot_async/__init__.py index ca439ab..5457ce8 100644 --- a/foobot_async/__init__.py +++ b/foobot_async/__init__.py @@ -154,24 +154,21 @@ def _get(self, path, **kwargs): with async_timeout.timeout(self._timeout): resp = yield from self._session.get( path, headers=dict(self._headers, **kwargs)) + resp_text = yield from resp.text() if resp.status == 400: - raise FoobotClient.BadFormat(resp.text()) + raise FoobotClient.BadFormat(resp_text) elif resp.status == 401: - raise FoobotClient.AuthFailure(resp.text()) + raise FoobotClient.AuthFailure(resp_text) elif resp.status == 403: - raise FoobotClient.ForbiddenAccess(resp.text()) + raise FoobotClient.ForbiddenAccess(resp_text) elif resp.status == 429: - raise FoobotClient.TooManyRequests(resp.text()) + raise FoobotClient.TooManyRequests(resp_text) elif resp.status == 500: - raise FoobotClient.InternalError(resp.text()) + raise FoobotClient.InternalError(resp_text) elif resp.status != 200: - raise FoobotClient.ClientError(resp.text()) + raise FoobotClient.ClientError(resp_text) return (yield from resp.json()) - @property - def last_data_request(self): - return self._last_data_request - class ClientError(Exception): """Generic Error.""" pass diff --git a/setup.py b/setup.py index e83de7a..cb1b46d 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setuptools.setup( name="foobot_async", - version="0.3.0", + version="0.3.1", url="https://github.com/reefab/foobot_async", author="Fabien Piuzzi", @@ -13,14 +13,13 @@ packages=setuptools.find_packages(), - install_requires=['aiohttp==2.3.10', 'async_timeout', 'typing>=3,<4'], + install_requires=['aiohttp>=2.3.10', 'async_timeout', 'typing>=3,<4'], zip_safe=True, classifiers=[ 'Development Status :: 4 - Beta', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', ], diff --git a/tox.ini b/tox.ini index f54cdcf..8e471ba 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=py34,py35,py36 +envlist=py35,py36 [testenv] commands=py.test --cov=foobot_async