pysmarlaapi 0.2.3__py3-none-any.whl → 0.3.0__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 +1 -1
- pysmarlaapi/classes/auth_token.py +9 -0
- pysmarlaapi/classes/connection.py +3 -1
- {pysmarlaapi-0.2.3.dist-info → pysmarlaapi-0.3.0.dist-info}/METADATA +3 -2
- {pysmarlaapi-0.2.3.dist-info → pysmarlaapi-0.3.0.dist-info}/RECORD +6 -6
- {pysmarlaapi-0.2.3.dist-info → pysmarlaapi-0.3.0.dist-info}/WHEEL +0 -0
pysmarlaapi/__init__.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import base64
|
|
1
2
|
from dataclasses import dataclass
|
|
2
3
|
from typing import Self
|
|
3
4
|
|
|
@@ -23,5 +24,13 @@ class AuthToken:
|
|
|
23
24
|
def from_string(cls, value) -> Self:
|
|
24
25
|
return AuthToken.from_json(jsonpickle.decode(value))
|
|
25
26
|
|
|
27
|
+
@classmethod
|
|
28
|
+
def from_base64(cls, value) -> Self:
|
|
29
|
+
token = base64.b64decode(value.encode()).decode()
|
|
30
|
+
return AuthToken.from_string(token)
|
|
31
|
+
|
|
26
32
|
def get_string(self) -> str:
|
|
27
33
|
return jsonpickle.encode(self, unpicklable=False)
|
|
34
|
+
|
|
35
|
+
def get_base64(self) -> str:
|
|
36
|
+
return base64.b64encode(self.get_string().encode()).decode()
|
|
@@ -6,7 +6,7 @@ from . import AuthToken
|
|
|
6
6
|
|
|
7
7
|
class Connection:
|
|
8
8
|
|
|
9
|
-
def __init__(self, url: str, token: AuthToken = None, token_str=None, token_json=None):
|
|
9
|
+
def __init__(self, url: str, token: AuthToken = None, token_str=None, token_json=None, token_b64=None):
|
|
10
10
|
self.url = url
|
|
11
11
|
if token is not None:
|
|
12
12
|
self.token = token
|
|
@@ -14,6 +14,8 @@ class Connection:
|
|
|
14
14
|
self.token = AuthToken.from_json(token_json)
|
|
15
15
|
elif token_str is not None:
|
|
16
16
|
self.token = AuthToken.from_string(token_str)
|
|
17
|
+
elif token_b64 is not None:
|
|
18
|
+
self.token = AuthToken.from_base64(token_b64)
|
|
17
19
|
else:
|
|
18
20
|
self.token = None
|
|
19
21
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pysmarlaapi
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Swing2Sleep Smarla API
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Swing2Sleep Smarla API
|
|
5
5
|
Author-email: Robin Lintermann <robin.lintermann@explicatis.com>
|
|
6
6
|
Requires-Python: >=3.11.9
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
9
10
|
Classifier: Programming Language :: Python :: 3.11
|
|
10
11
|
Classifier: Programming Language :: Python :: 3.12
|
|
11
12
|
Requires-Dist: aiohttp~=3.11.11
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
pysmarlaapi/__init__.py,sha256
|
|
1
|
+
pysmarlaapi/__init__.py,sha256=rYc5cElE-1A-6kEjomlPREjWX-q3rtM96h_cU1qBtcE,94
|
|
2
2
|
pysmarlaapi/classes/__init__.py,sha256=4F4LRzLQtj6AmzrXn74iHEZl-YElpMkb7MhEGkab504,71
|
|
3
|
-
pysmarlaapi/classes/auth_token.py,sha256=
|
|
4
|
-
pysmarlaapi/classes/connection.py,sha256=
|
|
3
|
+
pysmarlaapi/classes/auth_token.py,sha256=bxpp0gDzWuLzNSgUksN4mMlyvkDWLhqs3fT76Mb-0c8,950
|
|
4
|
+
pysmarlaapi/classes/connection.py,sha256=tmMaPEN1lu8fC8cV-SX6l4aVUkaAOh-32aZUhR7nMSU,1403
|
|
5
5
|
pysmarlaapi/connection_hub/__init__.py,sha256=6bLOH7cY_AyZwsMLKlFEA-kwmhKCI4pb0aLrflgfWdQ,4600
|
|
6
6
|
pysmarlaapi/federwiege/__init__.py,sha256=6Hk_Oqrk8AKoomNGdq3o-2pBW6E8ejvKArAc0DdOBGw,1743
|
|
7
7
|
pysmarlaapi/federwiege/classes/__init__.py,sha256=1cCe3iToaNmbUfy_7PynoPenNHtVcKC03rFc4ADqnbE,62
|
|
@@ -10,6 +10,6 @@ pysmarlaapi/federwiege/classes/service.py,sha256=J_4WjL0SyyxwlvBp-zpO9EaXNUUcTnO
|
|
|
10
10
|
pysmarlaapi/federwiege/services/__init__.py,sha256=F_54VQIYWAZaGm2ITzCJeG7G-6ARW2PfWvqaut56WN8,96
|
|
11
11
|
pysmarlaapi/federwiege/services/analyser_service.py,sha256=tQb6ijNlrtbz4igH7awdoBnOVHu4TO6SPJmMW5yeT3A,1340
|
|
12
12
|
pysmarlaapi/federwiege/services/babywiege_service.py,sha256=SJFPAsZaf4nSRmt6ojJq-9MtWqk1MdtcaPzBmTN3H0Y,2167
|
|
13
|
-
pysmarlaapi-0.
|
|
14
|
-
pysmarlaapi-0.
|
|
15
|
-
pysmarlaapi-0.
|
|
13
|
+
pysmarlaapi-0.3.0.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
|
14
|
+
pysmarlaapi-0.3.0.dist-info/METADATA,sha256=8XEqDobkr-EKHAYZGT2QQKRe0AJBRSqMqGn2bO6YpPM,925
|
|
15
|
+
pysmarlaapi-0.3.0.dist-info/RECORD,,
|
|
File without changes
|