python-bsblan 2.0.0__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: python-bsblan
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Asynchronous Python client for BSBLAN API
5
5
  License: MIT
6
6
  Keywords: bsblan,thermostat,client,api,async
@@ -20,7 +20,6 @@ Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Programming Language :: Python :: 3.13
21
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
22
  Requires-Dist: aiohttp (>=3.8.1)
23
- Requires-Dist: async-timeout (>=5.0.0,<6.0.0)
24
23
  Requires-Dist: backoff (>=2.2.1,<3.0.0)
25
24
  Requires-Dist: mashumaro (>=3.13.1,<4.0.0)
26
25
  Requires-Dist: orjson (>=3.9.10,<4.0.0)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-bsblan"
3
- version = "2.0.0"
3
+ version = "2.1.0"
4
4
  description = "Asynchronous Python client for BSBLAN API"
5
5
  authors = ["Willem-Jan van Rootselaar <liudgervr@gmail.com>"]
6
6
  maintainers = ["Willem-Jan van Rootselaar <liudgervr@gmail.com>"]
@@ -31,7 +31,6 @@ aiohttp = ">=3.8.1"
31
31
  yarl = ">=1.7.2"
32
32
  packaging = ">=21.3"
33
33
  backoff = "^2.2.1"
34
- async-timeout = "^5.0.0"
35
34
  mashumaro = "^3.13.1"
36
35
  orjson = "^3.9.10"
37
36
 
@@ -1,7 +1,7 @@
1
1
  """Asynchronous Python client for BSBLAN."""
2
2
 
3
3
  from .bsblan import BSBLAN, BSBLANConfig
4
- from .exceptions import BSBLANConnectionError, BSBLANError
4
+ from .exceptions import BSBLANAuthError, BSBLANConnectionError, BSBLANError
5
5
  from .models import (
6
6
  Device,
7
7
  DHWTimeSwitchPrograms,
@@ -15,6 +15,7 @@ from .models import (
15
15
  __all__ = [
16
16
  "BSBLAN",
17
17
  "BSBLANConfig",
18
+ "BSBLANAuthError",
18
19
  "BSBLANConnectionError",
19
20
  "BSBLANError",
20
21
  "DHWTimeSwitchPrograms",
@@ -32,6 +32,7 @@ from .constants import (
32
32
  APIConfig,
33
33
  )
34
34
  from .exceptions import (
35
+ BSBLANAuthError,
35
36
  BSBLANConnectionError,
36
37
  BSBLANError,
37
38
  BSBLANInvalidParameterError,
@@ -316,6 +317,10 @@ class BSBLAN:
316
317
  return self._process_response(response_data, base_path)
317
318
  except asyncio.TimeoutError as e:
318
319
  raise BSBLANConnectionError(BSBLANConnectionError.message_timeout) from e
320
+ except aiohttp.ClientResponseError as e:
321
+ if e.status in (401, 403):
322
+ raise BSBLANAuthError from e
323
+ raise BSBLANConnectionError(BSBLANConnectionError.message_error) from e
319
324
  except aiohttp.ClientError as e:
320
325
  raise BSBLANConnectionError(BSBLANConnectionError.message_error) from e
321
326
  except ValueError as e:
@@ -55,3 +55,9 @@ class BSBLANInvalidParameterError(BSBLANError):
55
55
  """
56
56
  self.message = f"Invalid values provided: {parameter}"
57
57
  super().__init__(self.message)
58
+
59
+
60
+ class BSBLANAuthError(BSBLANError):
61
+ """Raised when authentication fails."""
62
+
63
+ message: str = "Authentication failed. Please check your username and password."
File without changes