Ponika
Ponika is a Python library for interacting with the Teltonika devices.
Installation
You can install Ponika using pip:
pip install ponika
Usage
To use Ponika, you need to create an instance of PonikaClient with the appropriate parameters. Here's a basic example:
from ponika import PonikaClient
client = PonikaClient(
host="192.168.1.1",
username="your_username",
password="your_password",
# port=80, # Optional, default is 443 if tls=True else 80
# tls=False, # Optional, default is True
# verify_tls=False, # Optional, default is True
)
The library follows the structure of the Teltonika API endpoints. For example, to get the internet status from the endpoint /api/v1/internet_connection/status, you can do the following:
response = client.internet_connection.get_status()
if response.success and response.data:
print("Internet Status:")
print("IPv4:", response.data.ipv4_status)
print("IPv6:", response.data.ipv6_status)
print("DNS: ", response.data.dns_status)
else:
print("Error:", response.errors)
[!NOTE] Not all endpoints are implemented. If you need a specific endpoint that's missing, the existing endpoints should be a good reference for how to implement new ones.
Examples
Get Internet Status
response = client.internet_connection.get_status()
if response.success and response.data:
print("Internet Status:")
print("IPv4:", response.data.ipv4_status)
print("IPv6:", response.data.ipv6_status)
print("DNS: ", response.data.dns_status)
else:
print("Error:", response.errors)
Get GPS Position
response = client.gps.position.get_status()
if response.success and response.data:
print("GPS Position:")
print("Latitude:", response.data.latitude)
print("Longitude:", response.data.longitude)
print("Altitude:", response.data.altitude)
else:
print("Error:", response.errors)
Contributing
If you want to contribute to Ponika, feel free to open a pull request on the GitHub repository. Contributions are welcome!
The project is setup to use uv for development and requires prior installation. Once you've cloned the repository, you can set up the development environment by running:
uv sync
To run the tests, you can use the following command, updating the environment variables as needed:
# Required variables
# ---------------------
export TELTONIKA_HOST=192.168.1.1
export TELTONIKA_USERNAME=admin
export TELTONIKA_PASSWORD=password
# Optional variables
# ---------------------
# Enables SMS sending tests
export MOBILE_NUMBER=441234567890
# Run the tests
uv run pytest
Metadata
Release files for ponika 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ponika-0.5.1.tar.gz | 18.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ponika-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.5 kB
Release files / ponika-0.5.1.tar.gz
| Download URL | ponika-0.5.1.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e43a9913fb5824fd6cd3b98beee9b1487548d95fa4733a93334b9ed3a362f1fe
|
|
BLAKE2b-256 checksum How to use checksums |
74160cc662b7583cfb75a8dce0523a6036a6d1094d5564b338d17a1021786dd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / ponika-0.5.1-py3-none-any.whl
| Download URL | ponika-0.5.1-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba4719446a150ccc1cf55a1e609f31a9882d5af13619ca96f6b5e27628221597
|
|
BLAKE2b-256 checksum How to use checksums |
824e3f881de014f5d293dfdf4b72f5df2fe6e2215062cf6c4ed22e468eef7b6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|