kiosker-python-api 1.2.4__tar.gz → 1.2.6__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.4
2
2
  Name: kiosker-python-api
3
- Version: 1.2.4
3
+ Version: 1.2.6
4
4
  Summary: A python wrapper for the Kiosker API
5
5
  Project-URL: Homepage, https://kiosker.io
6
6
  Project-URL: Documentation, https://docs.kiosker.io
@@ -16,7 +16,18 @@ Requires-Dist: pytest; extra == 'test'
16
16
  Description-Content-Type: text/markdown
17
17
 
18
18
  # Python wrapper for Kiosker API
19
- Python wrapper for Kiosker API-integration.
19
+
20
+ This Python library provides a comprehensive wrapper for the Kiosker API, enabling developers to programmatically control and manage Kiosker devices. Kiosker is a professional web kiosk application for iOS that transforms iPads into secure, full-screen web browsers perfect for public displays, interactive kiosks, and digital signage solutions.
21
+
22
+ The kiosker-python-api package allows you to:
23
+ - **Remote Control**: Navigate web pages, refresh content, and control browser functions
24
+ - **Device Management**: Monitor device status, battery levels, and system information
25
+ - **Content Control**: Manage blackout screens for maintenance or emergency messaging
26
+ - **Screen Management**: Control screensaver behavior
27
+ - **System Maintenance**: Clear cookies, cache, and perform system operations
28
+ - **Network Discovery**: Automatically discover Kiosker devices on your network using ZeroConf
29
+
30
+ Whether you're managing a single kiosk or deploying a fleet of devices across multiple locations, this library provides the tools needed to integrate Kiosker devices into your existing infrastructure and workflows.
20
31
 
21
32
  ---
22
33
 
@@ -31,7 +42,7 @@ pip install kiosker-python-api
31
42
  ### Setup
32
43
 
33
44
  ```python
34
- KioskerAPI(host, token, port = 8081, ssl = False)
45
+ KioskerAPI(host, token, port = 8081, ssl = False, verify = False)
35
46
  ```
36
47
 
37
48
  ```python
@@ -40,6 +51,29 @@ from kiosker import Status, Result, Blackout, ScreensaverState
40
51
  api = KioskerAPI('10.0.1.100', 'token')
41
52
  ```
42
53
 
54
+ #### Constructor Parameters
55
+
56
+ - **host** (str): IP address or hostname of the Kiosker device
57
+ - **token** (str): Authentication token for API access
58
+ - **port** (int, optional): Port number (default: 8081)
59
+ - **ssl** (bool, optional): Use HTTPS instead of HTTP (default: False)
60
+ - **verify** (bool | ssl.SSLContext, optional): SSL certificate verification. Set to False to disable SSL verification for self-signed certificates (default: False)
61
+
62
+ ---
63
+
64
+ ### Device Discovery with ZeroConf
65
+
66
+ Kiosker devices advertise themselves on the local network using ZeroConf (Bonjour/mDNS) autodiscovery. This allows you to automatically discover Kiosker devices without needing to know their IP addresses beforehand.
67
+
68
+ #### Service Information
69
+
70
+ Kiosker devices broadcast the following service:
71
+ - **Service Type**: `_kiosker._tcp`
72
+ - **TXT Records**:
73
+ - `version`: App version (e.g., "25.1.0 (230)")
74
+ - `app`: App name (e.g., "Kiosker Pro")
75
+ - `uuid`: Unique device identifier (e.g., "2904C1F2-93FB-4954-BF85-FAAEFBA814F6")
76
+
43
77
  ---
44
78
 
45
79
  ### Functions
@@ -134,7 +168,7 @@ print(f"Screensaver interaction result: {result}")
134
168
 
135
169
  #### Set Screensaver State
136
170
  ```python
137
- result = api.screensaver_set_state(disabled=True)
171
+ result = api.screensaver_set_disabled_state(disabled=True)
138
172
  print(f"Screensaver disabled: {result}")
139
173
  ```
140
174
  **Description**: Enables or disables the screensaver.
@@ -194,6 +228,8 @@ Represents the current status of the kiosk.
194
228
  - `battery_state` (str): Current battery state (e.g., charging, discharging).
195
229
  - `model` (str): Device model.
196
230
  - `os_version` (str): Operating system version.
231
+ - `app_name` (str): Name of the currently running app.
232
+ - `app_version` (str): Version of the currently running app.
197
233
  - `last_interaction` (datetime): Timestamp of the last user interaction.
198
234
  - `last_motion` (Optional[datetime]): Timestamp of the last detected motion.
199
235
  - `last_update` (datetime): Timestamp of the last status update.
@@ -265,7 +301,7 @@ python -m build
265
301
  twine upload --repository testpypi dist/*
266
302
  ```
267
303
 
268
- 7. Upload to prod
304
+ 8. Upload to prod
269
305
  ```shell
270
306
  twine upload dist/*
271
307
  ```
@@ -1,5 +1,16 @@
1
1
  # Python wrapper for Kiosker API
2
- Python wrapper for Kiosker API-integration.
2
+
3
+ This Python library provides a comprehensive wrapper for the Kiosker API, enabling developers to programmatically control and manage Kiosker devices. Kiosker is a professional web kiosk application for iOS that transforms iPads into secure, full-screen web browsers perfect for public displays, interactive kiosks, and digital signage solutions.
4
+
5
+ The kiosker-python-api package allows you to:
6
+ - **Remote Control**: Navigate web pages, refresh content, and control browser functions
7
+ - **Device Management**: Monitor device status, battery levels, and system information
8
+ - **Content Control**: Manage blackout screens for maintenance or emergency messaging
9
+ - **Screen Management**: Control screensaver behavior
10
+ - **System Maintenance**: Clear cookies, cache, and perform system operations
11
+ - **Network Discovery**: Automatically discover Kiosker devices on your network using ZeroConf
12
+
13
+ Whether you're managing a single kiosk or deploying a fleet of devices across multiple locations, this library provides the tools needed to integrate Kiosker devices into your existing infrastructure and workflows.
3
14
 
4
15
  ---
5
16
 
@@ -14,7 +25,7 @@ pip install kiosker-python-api
14
25
  ### Setup
15
26
 
16
27
  ```python
17
- KioskerAPI(host, token, port = 8081, ssl = False)
28
+ KioskerAPI(host, token, port = 8081, ssl = False, verify = False)
18
29
  ```
19
30
 
20
31
  ```python
@@ -23,6 +34,29 @@ from kiosker import Status, Result, Blackout, ScreensaverState
23
34
  api = KioskerAPI('10.0.1.100', 'token')
24
35
  ```
25
36
 
37
+ #### Constructor Parameters
38
+
39
+ - **host** (str): IP address or hostname of the Kiosker device
40
+ - **token** (str): Authentication token for API access
41
+ - **port** (int, optional): Port number (default: 8081)
42
+ - **ssl** (bool, optional): Use HTTPS instead of HTTP (default: False)
43
+ - **verify** (bool | ssl.SSLContext, optional): SSL certificate verification. Set to False to disable SSL verification for self-signed certificates (default: False)
44
+
45
+ ---
46
+
47
+ ### Device Discovery with ZeroConf
48
+
49
+ Kiosker devices advertise themselves on the local network using ZeroConf (Bonjour/mDNS) autodiscovery. This allows you to automatically discover Kiosker devices without needing to know their IP addresses beforehand.
50
+
51
+ #### Service Information
52
+
53
+ Kiosker devices broadcast the following service:
54
+ - **Service Type**: `_kiosker._tcp`
55
+ - **TXT Records**:
56
+ - `version`: App version (e.g., "25.1.0 (230)")
57
+ - `app`: App name (e.g., "Kiosker Pro")
58
+ - `uuid`: Unique device identifier (e.g., "2904C1F2-93FB-4954-BF85-FAAEFBA814F6")
59
+
26
60
  ---
27
61
 
28
62
  ### Functions
@@ -117,7 +151,7 @@ print(f"Screensaver interaction result: {result}")
117
151
 
118
152
  #### Set Screensaver State
119
153
  ```python
120
- result = api.screensaver_set_state(disabled=True)
154
+ result = api.screensaver_set_disabled_state(disabled=True)
121
155
  print(f"Screensaver disabled: {result}")
122
156
  ```
123
157
  **Description**: Enables or disables the screensaver.
@@ -177,6 +211,8 @@ Represents the current status of the kiosk.
177
211
  - `battery_state` (str): Current battery state (e.g., charging, discharging).
178
212
  - `model` (str): Device model.
179
213
  - `os_version` (str): Operating system version.
214
+ - `app_name` (str): Name of the currently running app.
215
+ - `app_version` (str): Version of the currently running app.
180
216
  - `last_interaction` (datetime): Timestamp of the last user interaction.
181
217
  - `last_motion` (Optional[datetime]): Timestamp of the last detected motion.
182
218
  - `last_update` (datetime): Timestamp of the last status update.
@@ -248,7 +284,7 @@ python -m build
248
284
  twine upload --repository testpypi dist/*
249
285
  ```
250
286
 
251
- 7. Upload to prod
287
+ 8. Upload to prod
252
288
  ```shell
253
289
  twine upload dist/*
254
290
  ```
@@ -1,10 +1,11 @@
1
+ import ssl
1
2
  import httpx
2
3
  from .data import Status, Result, Blackout, ScreensaverState
3
4
 
4
5
  API_PATH = '/api/v1'
5
6
 
6
7
  class KioskerAPI:
7
- def __init__(self, host, token, port=8081, ssl=False):
8
+ def __init__(self, host, token, port=8081, ssl=False, verify: bool | ssl.SSLContext =False):
8
9
  if ssl:
9
10
  self.conf_host = f'https://{host}:{port}'
10
11
  else:
@@ -13,8 +14,10 @@ class KioskerAPI:
13
14
  self.conf_headers = {'accept': 'application/json',
14
15
  'Authorization': f'Bearer {token}'}
15
16
 
17
+ self.verify = verify
18
+
16
19
  def _get(self, path: str):
17
- r = httpx.get(f'{self.conf_host}{API_PATH}{path}', headers=self.conf_headers)
20
+ r = httpx.get(f'{self.conf_host}{API_PATH}{path}', headers=self.conf_headers, verify=self.verify)
18
21
  if r.status_code == 200:
19
22
  return r.json()
20
23
  elif r.status_code == 401:
@@ -27,7 +30,7 @@ class KioskerAPI:
27
30
  def _post(self, path: str, json=None):
28
31
  if json is None:
29
32
  json = {}
30
- r = httpx.post(f'{self.conf_host}{API_PATH}{path}', headers=self.conf_headers, json=json)
33
+ r = httpx.post(f'{self.conf_host}{API_PATH}{path}', headers=self.conf_headers, json=json, verify=self.verify)
31
34
  if r.status_code == 200:
32
35
  return r.json()
33
36
  elif r.status_code == 401:
@@ -14,10 +14,11 @@ class Status:
14
14
  last_update: datetime
15
15
  device_id: str
16
16
  last_motion: Optional[datetime]
17
+ ambient_light: Optional[float]
17
18
 
18
19
  @classmethod
19
20
  def from_dict(cls, status_data):
20
- return cls(battery_level=status_data['batteryLevel'], battery_state=status_data['batteryState'], model=status_data['model'], os_version=status_data['osVersion'], app_name=status_data['appName'], app_version=status_data['appVersion'], last_interaction=datetime.fromisoformat(status_data['lastInteraction']), last_motion=datetime.fromisoformat(status_data['lastMotion']) if status_data.get('lastMotion') else None, last_update=datetime.fromisoformat(status_data['date']), device_id=status_data['deviceId'])
21
+ return cls(battery_level=status_data['batteryLevel'], battery_state=status_data['batteryState'], model=status_data['model'], os_version=status_data['osVersion'], app_name=status_data['appName'], app_version=status_data['appVersion'], last_interaction=datetime.fromisoformat(status_data['lastInteraction']), last_motion=datetime.fromisoformat(status_data['lastMotion']) if status_data.get('lastMotion') else None, last_update=datetime.fromisoformat(status_data['date']), device_id=status_data['deviceId'], ambient_light=status_data['ambientLight'] if status_data.get('ambientLight') else None)
21
22
 
22
23
  @dataclass
23
24
  class Result:
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
  [project]
6
6
  name = "kiosker-python-api"
7
7
  readme = "README.md"
8
- version = "1.2.4"
8
+ version = "1.2.6"
9
9
  license = "MIT"
10
10
  description = "A python wrapper for the Kiosker API"
11
11
  keywords = ["kiosk", "kiosker", "api", "kiosker pro"]
@@ -4,10 +4,12 @@ import os
4
4
 
5
5
  host = os.environ["HOST"]
6
6
  token = os.environ["TOKEN"]
7
+ ssl = os.environ.get("SSL", "false").lower() in ("true", "1", "yes", "on")
8
+ verify = os.environ.get("VERIFY", "false").lower() in ("true", "1", "yes", "on")
7
9
 
10
+ api = KioskerAPI(host, token, ssl=ssl, verify=verify)
8
11
 
9
12
  def test_ping():
10
- api = KioskerAPI(host, token)
11
13
 
12
14
  result = api.ping()
13
15
 
@@ -16,8 +18,6 @@ def test_ping():
16
18
 
17
19
  def test_status():
18
20
 
19
- api = KioskerAPI(host, token)
20
-
21
21
  status = api.status()
22
22
 
23
23
  print('Status:')
@@ -28,16 +28,16 @@ def test_status():
28
28
  print(f'Battery state: {status.battery_state}')
29
29
  print(f'Last interaction: {status.last_interaction}')
30
30
  print(f'Last motion: {status.last_motion}')
31
+ print(f'Ambient light: {status.ambient_light}')
31
32
  print(f'Last status update: {status.last_update}')
32
33
  print(f'App name: {status.app_name}')
33
34
  print(f'App version: {status.app_version}')
35
+
34
36
 
35
37
  assert api.ping() == True
36
-
38
+
37
39
  def test_navigate():
38
40
 
39
- api = KioskerAPI(host, token)
40
-
41
41
  print('Navigating to URL...')
42
42
  result = api.navigate_url('https://google.com')
43
43
  print(f'Navigate URL: {result}')
@@ -70,8 +70,6 @@ def test_navigate():
70
70
 
71
71
  def test_print():
72
72
 
73
- api = KioskerAPI(host, token)
74
-
75
73
  print('Printing...')
76
74
  result = api.print()
77
75
  print(f'Print: {result}')
@@ -80,8 +78,6 @@ def test_print():
80
78
 
81
79
  def test_clear():
82
80
 
83
- api = KioskerAPI(host, token)
84
-
85
81
  print('Clearing cookies...')
86
82
  result = api.clear_cookies()
87
83
  print(f'Clear cookies: {result}')
@@ -96,8 +92,6 @@ def test_clear():
96
92
 
97
93
  def test_screensaver():
98
94
 
99
- api = KioskerAPI(host, token)
100
-
101
95
  print('Interacting with screensaver...')
102
96
  result = api.screensaver_interact()
103
97
  print(f'Screensaver interact: {result}')
@@ -133,9 +127,7 @@ def test_screensaver():
133
127
  print(f'Screensaver state: {state}')
134
128
 
135
129
  def test_blackout():
136
-
137
- api = KioskerAPI(host, token)
138
-
130
+
139
131
  print(f'Blackout state: {api.blackout_get()}')
140
132
 
141
133
  api.blackout_set(Blackout(visible=True, text='This is a test from Python that should clear', background='#000000', foreground='#FFFFFF', icon='ladybug', expire=20))
@@ -166,4 +158,4 @@ def test_blackout():
166
158
 
167
159
  api.blackout_set(Blackout(visible=True, text='This is a test from Python that is dismissible', background='#000000', foreground='#FFFFFF', icon='hand.point.up', expire=25, dismissible=True, buttonBackground='#FA0000', buttonForeground='#FFFFFF', buttonText='Hide me then...', sound="1003"))
168
160
 
169
- time.sleep(5)
161
+ time.sleep(5)