Skip to main content

A python wrapper for the Kiosker API

Project description

Python wrapper for Kiosker API

Python wrapper for Kiosker API-integration.


Installation

pip install kiosker-python-api

Setup

KioskerAPI(host, token, port = 8081, ssl = False)
from kiosker import KioskerAPI
from kiosker import Status, Result, Blackout, ScreensaverState
api = KioskerAPI('10.0.1.100', 'token')

Functions

Get Status

status = api.status()

print('Status:')
print(f'Device ID: {status.device_id}')
print(f'Model: {status.model}')
print(f'OS version: {status.os_version}')
print(f'Battery level: {status.battery_level}%')
print(f'Battery state: {status.battery_state}')
print(f'Last interaction: {status.last_interaction}')
print(f'Last motion: {status.last_motion}')
print(f'App name: {status.app_name}')
print(f'App version: {status.app_version}')
print(f'Last status update: {status.last_update}')

Description: Retrieves the current status of the kiosk.

Ping the API

result = api.ping()
print(f"Ping successful: {result}")

Description: Checks if the API is reachable. Returns True if successful, otherwise raises an error.

Navigate to a URL

result = api.navigate_url('https://example.com')
print(f"Navigation result: {result}")

Description: Navigates the kiosk to the specified URL.

Refresh the Page

result = api.navigate_refresh()
print(f"Refresh result: {result}")

Description: Refreshes the current page on the kiosk.

Navigate Home

result = api.navigate_home()
print(f"Home navigation result: {result}")

Description: Navigates the kiosk to the home page.

Navigate Forward

result = api.navigate_forward()
print(f"Navigate forward result: {result}")

Description: Navigates forward in the browser's history.

Navigate Backward

result = api.navigate_backward()
print(f"Navigate backward result: {result}")

Description: Navigates backward in the browser's history.

Print

result = api.print()
print(f"Print result: {result}")

Description: Sends a print command to the kiosk.

Clear Cookies

result = api.clear_cookies()
print(f"Cookies cleared: {result}")

Description: Clears all cookies stored on the kiosk.

Clear Cache

result = api.clear_cache()
print(f"Cache cleared: {result}")

Description: Clears the cache on the kiosk.

Interact with Screensaver

result = api.screensaver_interact()
print(f"Screensaver interaction result: {result}")

Description: Simulates user interaction with the screensaver to prevent it from activating.

Set Screensaver State

result = api.screensaver_set_state(disabled=True)
print(f"Screensaver disabled: {result}")

Description: Enables or disables the screensaver.

Get Screensaver State

state = api.screensaver_get_state()
print(f"Screensaver state: {state}")

Description: Retrieves the current state of the screensaver (enabled or disabled).

Set Blackout

from kiosker import Blackout

blackout = Blackout(
    visible=True,                   # Required: show blackout screen
    text="Maintenance in progress", # Optional: text to display
    background="#000000",           # Optional: background color (hex)
    foreground="#FFFFFF",           # Optional: foreground/text color (hex)
    icon="warning",                 # Optional: icon name (SF Symbol)
    expire=60,                      # Optional: time in seconds before blackout expires
    dismissible=True,               # Optional: allow user to dismiss blackout with a button
    buttonBackground="#FF0000",     # Optional: button background color (hex)
    buttonForeground="#FFFFFF",     # Optional: button text color (hex)
    buttonText="OK",                # Optional: button label
    sound="1003"                    # Optional: sound to play (SystemSoundID)
)
result = api.blackout_set(blackout)
print(f"Blackout set: {result}")

Description: Sets a blackout screen with customizable text, colors, expiration time, and optional button/sound options.

Get Blackout State

blackout_state = api.blackout_get()
print(f"Blackout state: {blackout_state}")

Description: Retrieves the current state of the blackout screen.

Clear Blackout

result = api.blackout_clear()
print(f"Blackout cleared: {result}")

Description: Clears the blackout screen.


Objects

Status

Represents the current status of the kiosk.

Attributes:

  • battery_level (int): Battery percentage.
  • battery_state (str): Current battery state (e.g., charging, discharging).
  • model (str): Device model.
  • os_version (str): Operating system version.
  • last_interaction (datetime): Timestamp of the last user interaction.
  • last_motion (Optional[datetime]): Timestamp of the last detected motion.
  • last_update (datetime): Timestamp of the last status update.
  • device_id (str): Unique identifier for the device.

Result

Represents the result of an API operation.

Attributes:

  • error (bool): Indicates if an error occurred.
  • reason (Optional[str]): Reason for the error, if any.
  • function (Optional[str]): Name of the function that caused the error.

Blackout

Represents a blackout screen configuration.

Attributes:

  • visible (bool): Whether the blackout screen is visible.
  • background (Optional[str]): Background color in hex format.
  • foreground (Optional[str]): Foreground/text color in hex format.
  • expire (Optional[int]): Time in seconds before the blackout screen expires.
  • text (Optional[str]): Text to display on the blackout screen.
  • icon (Optional[str]): Icon to display on the blackout screen.
  • dismissible (Optional[bool]): Allow user to dismiss blackout with a button.
  • buttonBackground (Optional[str]): Button background color (hex).
  • buttonForeground (Optional[str]): Button text color (hex).
  • buttonText (Optional[str]): Button label.
  • sound (Optional[str]): Sound to play (SystemSoundID).

ScreensaverState

Represents the state of the screensaver.

Attributes:

  • visible (bool): Whether the screensaver is currently visible.
  • disabled (bool): Whether the screensaver is disabled (cannot activate).

Development

  1. Clone the project

  2. Create a virtual environment

python3 -m venv venv
  1. Activate the virtual environment
source venv/bin/activate
  1. Install dependencies
pip install wheel setuptools twine pytest httpx
  1. Run tests
HOST="0.0.0.0" TOKEN="" pytest -s
  1. Build the library
python -m build
  1. Upload to test
twine upload --repository testpypi dist/*
  1. Upload to prod
twine upload dist/*

API Documentation


Get Kiosker for iOS on the App Store

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kiosker_python_api-1.2.4.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kiosker_python_api-1.2.4-py2.py3-none-any.whl (6.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file kiosker_python_api-1.2.4.tar.gz.

File metadata

  • Download URL: kiosker_python_api-1.2.4.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for kiosker_python_api-1.2.4.tar.gz
Algorithm Hash digest
SHA256 02a904fc05a6494a7555d5b2a6eac39fa59bbf029eb3077827a89dca2361e281
MD5 ea8cf9c4da1bec8831eaab656ad15986
BLAKE2b-256 8dbf465c2f3aab9dd8e69bc53afb631b464042de7826f1db8a289b8b3f274a8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for kiosker_python_api-1.2.4.tar.gz:

Publisher: python-publish.yml on Top-North/kiosker-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kiosker_python_api-1.2.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for kiosker_python_api-1.2.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 34f6ea1d88c45d0e274acd1deafb3b6c48fee6715d16f010ac926a85fbaab5b4
MD5 28e8d9d4063e57966abf079d8e7d66ed
BLAKE2b-256 a9b89e741e05328ae82effdfa10280fc6a87d42a383d894b68b5f743c32d03e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for kiosker_python_api-1.2.4-py2.py3-none-any.whl:

Publisher: python-publish.yml on Top-North/kiosker-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page