From 616ed6f9422d63dc68f80cfc3de6425f67d64c74 Mon Sep 17 00:00:00 2001 From: Keilin Date: Mon, 28 Mar 2022 18:57:35 -0400 Subject: [PATCH] Add 404 to api response that require authentication --- sense_energy/__init__.py | 2 +- sense_energy/asyncsenseable.py | 4 ++-- setup.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sense_energy/__init__.py b/sense_energy/__init__.py index f95eca8..8e37870 100644 --- a/sense_energy/__init__.py +++ b/sense_energy/__init__.py @@ -8,4 +8,4 @@ from .plug_instance import PlugInstance from .sense_link import SenseLink -__version__ = "0.10.3" +__version__ = "0.10.4" diff --git a/sense_energy/asyncsenseable.py b/sense_energy/asyncsenseable.py index 85b1bc3..5ffb17e 100644 --- a/sense_energy/asyncsenseable.py +++ b/sense_energy/asyncsenseable.py @@ -141,8 +141,8 @@ async def _api_call(self, url, payload={}): async with self._client_session.get( API_URL + url, headers=self.headers, timeout=timeout, data=payload ) as resp: - # check for 200 return - if resp.status == 401 or resp.status == 403: + # 4xx represents unauthenticated + if resp.status == 401 or resp.status == 403 or resp.status == 404: raise SenseAuthenticationException(f"API Return Code: {resp.status}") if resp.status != 200: diff --git a/setup.py b/setup.py index e92ee37..c01d294 100644 --- a/setup.py +++ b/setup.py @@ -12,14 +12,14 @@ 'websockets;python_version>="3.5"', 'aiohttp;python_version>="3.5"', ], - version = '0.10.3', + version = '0.10.4', description = 'API for the Sense Energy Monitor', long_description=long_description, long_description_content_type="text/markdown", author = 'scottbonline', author_email = 'scottbonline@gmail.com', url = 'https://github.com/scottbonline/sense', - download_url = 'https://github.com/scottbonline/sense/archive/0.10.3.tar.gz', + download_url = 'https://github.com/scottbonline/sense/archive/0.10.4.tar.gz', keywords = ['sense', 'energy', 'api'], classifiers = [ 'Programming Language :: Python :: 2',