pysmarlaapi 0.7.1__py3-none-any.whl → 0.7.2__py3-none-any.whl

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.

Potentially problematic release.


This version of pysmarlaapi might be problematic. Click here for more details.

pysmarlaapi/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.7.1"
1
+ __version__ = "0.7.2"
2
2
 
3
3
  from .classes import Connection
4
4
  from .federwiege import Federwiege
@@ -27,22 +27,26 @@ class Connection:
27
27
  async def refresh_token(self) -> bool:
28
28
  try:
29
29
  async with aiohttp.ClientSession(self.url) as session:
30
- response = await session.post(
31
- "/api/AppParing/getToken",
32
- headers={"accept": "*/*", "Content-Type": "application/json"},
33
- data=jsonpickle.encode(self.token, unpicklable=False),
34
- )
30
+ content = await self._get_token(session)
35
31
  except (aiohttp.ClientError, asyncio.TimeoutError):
36
32
  return False
37
33
 
38
- if response.status != 200:
34
+ if not content:
39
35
  return False
40
36
 
41
- content = await response.json()
42
-
43
37
  try:
44
38
  self.token = AuthToken.from_json(content)
45
39
  except ValueError:
46
40
  return False
47
41
 
48
42
  return True
43
+
44
+ async def _get_token(self, session: aiohttp.ClientSession):
45
+ async with await session.post(
46
+ "/api/AppParing/getToken",
47
+ headers={"accept": "*/*", "Content-Type": "application/json"},
48
+ data=jsonpickle.encode(self.token, unpicklable=False),
49
+ ) as response:
50
+ if response.status != 200:
51
+ return None
52
+ return await response.json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pysmarlaapi
3
- Version: 0.7.1
3
+ Version: 0.7.2
4
4
  Summary: Swing2Sleep Smarla API
5
5
  Author-email: Robin Lintermann <robin.lintermann@explicatis.com>
6
6
  Requires-Python: >=3.11
@@ -1,7 +1,7 @@
1
- pysmarlaapi/__init__.py,sha256=rDgCmbkCZQZlhzANFZ4JVqkxlURuDWtkn4yS9HKCPqI,90
1
+ pysmarlaapi/__init__.py,sha256=-_WRkoIWqJXxNINnMGUcITX0ZapqA9IK2jQQvtO1Xpg,90
2
2
  pysmarlaapi/classes/__init__.py,sha256=N-ZV3Id_t5ciovUlPUGCk5SLLiMUonRoQZWpfOU4ZsM,69
3
3
  pysmarlaapi/classes/auth_token.py,sha256=dpo0lBT9Advm3Iyxu-fT9sq078U2OxgXXBuF5gbBZkM,942
4
- pysmarlaapi/classes/connection.py,sha256=vbEHENKDUANCemQriH66sofHmPPCe2THSY9dm7SIt1M,1400
4
+ pysmarlaapi/classes/connection.py,sha256=vVC0Ur0KQUb4pNDVuCYnfk-JXs-O-FwYVO-2y1E2g6g,1551
5
5
  pysmarlaapi/connection_hub/__init__.py,sha256=NR5xql57L0Xs0JfeEVOVLITWSaVMblEo6pcvB7fn5TQ,4443
6
6
  pysmarlaapi/federwiege/__init__.py,sha256=7Fl_GnwN6GbS8fhkHdfMhuYFospKnap40pvUtSGIeoE,1933
7
7
  pysmarlaapi/federwiege/classes/__init__.py,sha256=DFJJVOKpra40S4ZX_oq2RyMazg6Nx0c8hoPggmj1bXA,60
@@ -11,7 +11,7 @@ pysmarlaapi/federwiege/services/__init__.py,sha256=bJuOsk0lw9WWxB1NZodRTL8Pm_Ra8
11
11
  pysmarlaapi/federwiege/services/analyser_service.py,sha256=y02j4cNvRAblBa1pTlJi1u1_7c3vV4xMj9uHe_vwV38,1789
12
12
  pysmarlaapi/federwiege/services/babywiege_service.py,sha256=8hCu-uFAcT_G0F5oUD3EqYzb02L2bE5mVF72NrunEpc,2070
13
13
  pysmarlaapi/federwiege/services/info_service.py,sha256=03a4eZFAL1zaIaWo1e-a_Zm2wVl0RuFLm2rTS7ABJIQ,1248
14
- pysmarlaapi-0.7.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
- pysmarlaapi-0.7.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
16
- pysmarlaapi-0.7.1.dist-info/METADATA,sha256=bMPiRef95hRV4Yk2JT-2W6dbMGuPI1qAK0hZstD67MY,1106
17
- pysmarlaapi-0.7.1.dist-info/RECORD,,
14
+ pysmarlaapi-0.7.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
+ pysmarlaapi-0.7.2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
16
+ pysmarlaapi-0.7.2.dist-info/METADATA,sha256=_J3AqLiJnYmc1UMPdB8jWpL_xntGRZcn1fsZCiSOMF8,1106
17
+ pysmarlaapi-0.7.2.dist-info/RECORD,,