python-terminusgps 41.2.0__tar.gz → 41.3.0__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.
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/PKG-INFO +1 -1
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/conf.py +1 -1
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/pyproject.toml +1 -1
- python_terminusgps-41.3.0/terminusgps/wialon/items/__init__.py +1 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/items/base.py +2 -2
- python_terminusgps-41.3.0/terminusgps/wialon/items/factory.py +50 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/utils.py +7 -6
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/uv.lock +1 -1
- python_terminusgps-41.2.0/terminusgps/wialon/factory.py +0 -60
- python_terminusgps-41.2.0/terminusgps/wialon/items/__init__.py +0 -7
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/.gitignore +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/COPYING +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/README.md +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/Makefile +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/make.bat +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/auth.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/constants.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/controllers.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/examples.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/index.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/profiles.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/subscriptions.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/utils.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/validators.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/django/forms.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/django/index.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/django/mixins.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/django/settings.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/django/validators.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/index.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/wialon/constants.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/wialon/errors.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/wialon/examples.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/wialon/flags.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/wialon/index.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/wialon/items.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/wialon/session.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/wialon/utils.rst +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/__init__.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/__init__.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/auth.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/constants.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/controllers.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/profiles/__init__.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/profiles/addresses.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/profiles/customers.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/profiles/payments.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/subscriptions.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/utils.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/validators.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/django/__init__.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/django/forms/__init__.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/django/forms/fields.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/django/forms/forms.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/django/forms/renderer.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/django/forms/widgets.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/django/mixins.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/django/settings.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/django/utils.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/django/validators.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/__init__.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/constants.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/flags.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/items/account.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/items/resource.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/items/retranslator.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/items/route.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/items/unit.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/items/unit_group.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/items/user.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/session.py +0 -0
- {python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/validators.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-terminusgps
|
|
3
|
-
Version: 41.
|
|
3
|
+
Version: 41.3.0
|
|
4
4
|
Summary: Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more.
|
|
5
5
|
Project-URL: Documentation, https://docs.terminusgps.com
|
|
6
6
|
Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
|
|
@@ -18,7 +18,7 @@ django.setup()
|
|
|
18
18
|
project = "python-terminusgps"
|
|
19
19
|
copyright = "2025, Terminus GPS, LLC"
|
|
20
20
|
author = "Terminus GPS, LLC"
|
|
21
|
-
release = "41.
|
|
21
|
+
release = "41.3.0"
|
|
22
22
|
|
|
23
23
|
# -- General configuration ---------------------------------------------------
|
|
24
24
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "python-terminusgps"
|
|
3
|
-
version = "41.
|
|
3
|
+
version = "41.3.0"
|
|
4
4
|
description = "Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [ {name = "Blake Nall", email = "blake@terminusgps.com" } ]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .factory import WialonObjectFactory
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from abc import abstractmethod
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
2
|
from functools import wraps
|
|
3
3
|
|
|
4
4
|
from terminusgps.wialon import constants, flags
|
|
@@ -16,7 +16,7 @@ def requires_id(meth):
|
|
|
16
16
|
return wrapper
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
class WialonObject:
|
|
19
|
+
class WialonObject(ABC):
|
|
20
20
|
"""Base class for Wialon objects in a Wialon session."""
|
|
21
21
|
|
|
22
22
|
def __init__(self, session: WialonSession, id: int | str | None = None) -> None:
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from terminusgps.wialon.items.account import WialonAccount
|
|
2
|
+
from terminusgps.wialon.items.base import WialonObject
|
|
3
|
+
from terminusgps.wialon.items.resource import WialonResource
|
|
4
|
+
from terminusgps.wialon.items.retranslator import WialonRetranslator
|
|
5
|
+
from terminusgps.wialon.items.route import WialonRoute
|
|
6
|
+
from terminusgps.wialon.items.unit import WialonUnit
|
|
7
|
+
from terminusgps.wialon.items.unit_group import WialonUnitGroup
|
|
8
|
+
from terminusgps.wialon.items.user import WialonUser
|
|
9
|
+
from terminusgps.wialon.session import WialonSession
|
|
10
|
+
|
|
11
|
+
WIALON_ITEMSTYPE_MAP = {
|
|
12
|
+
"account": WialonAccount,
|
|
13
|
+
"avl_hw": None,
|
|
14
|
+
"avl_resource": WialonResource,
|
|
15
|
+
"avl_retranslator": WialonRetranslator,
|
|
16
|
+
"avl_route": WialonRoute,
|
|
17
|
+
"avl_unit": WialonUnit,
|
|
18
|
+
"avl_unit_group": WialonUnitGroup,
|
|
19
|
+
"user": WialonUser,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class WialonObjectFactory:
|
|
24
|
+
"""Creates and retrieves Wialon objects from Wialon."""
|
|
25
|
+
|
|
26
|
+
def __init__(self, session: WialonSession) -> None:
|
|
27
|
+
# TODO: Add session refreshing
|
|
28
|
+
self.session = session
|
|
29
|
+
|
|
30
|
+
def get(self, id: int | str, items_type: str) -> WialonObject:
|
|
31
|
+
"""Returns a Wialon object that already exists in Wialon by id."""
|
|
32
|
+
if isinstance(id, str) and not id.isdigit():
|
|
33
|
+
raise ValueError(f"'id' can only be digits, got '{id}'.")
|
|
34
|
+
if items_type not in WIALON_ITEMSTYPE_MAP:
|
|
35
|
+
raise ValueError(f"Invalid Wialon items type: '{items_type}'.")
|
|
36
|
+
cls = WIALON_ITEMSTYPE_MAP.get(items_type)
|
|
37
|
+
if cls is None:
|
|
38
|
+
raise ValueError(f"Wialon items type '{items_type}' is not implemented.")
|
|
39
|
+
return cls(session=self.session, id=int(id))
|
|
40
|
+
|
|
41
|
+
def create(self, items_type: str, *args, **kwargs) -> WialonObject:
|
|
42
|
+
"""Returns a Wialon object after creating it in Wialon."""
|
|
43
|
+
if items_type not in WIALON_ITEMSTYPE_MAP:
|
|
44
|
+
raise ValueError(f"Invalid Wialon items type: '{items_type}'.")
|
|
45
|
+
cls = WIALON_ITEMSTYPE_MAP.get(items_type)
|
|
46
|
+
if cls is None:
|
|
47
|
+
raise ValueError(f"Wialon items type '{items_type}' is not implemented.")
|
|
48
|
+
obj = cls(session=self.session, id=None)
|
|
49
|
+
obj.create(*args, **kwargs)
|
|
50
|
+
return obj
|
|
@@ -2,9 +2,10 @@ import secrets
|
|
|
2
2
|
import string
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
|
-
from . import flags
|
|
6
|
-
from .items import WialonUnit
|
|
7
|
-
from .
|
|
5
|
+
from terminusgps.wialon import flags
|
|
6
|
+
from terminusgps.wialon.items.unit import WialonUnit
|
|
7
|
+
from terminusgps.wialon.items.user import WialonUser
|
|
8
|
+
from terminusgps.wialon.session import WialonSession
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
def get_hw_types(session: WialonSession) -> list[dict[str, str | int]]:
|
|
@@ -30,7 +31,7 @@ def get_hw_types(session: WialonSession) -> list[dict[str, str | int]]:
|
|
|
30
31
|
return session.wialon_api.core_get_hw_types()
|
|
31
32
|
|
|
32
33
|
|
|
33
|
-
def get_user_by_name(name: str, session: WialonSession) ->
|
|
34
|
+
def get_user_by_name(name: str, session: WialonSession) -> WialonUser | None:
|
|
34
35
|
"""
|
|
35
36
|
Returns a Wialon user by name, if it exists.
|
|
36
37
|
|
|
@@ -58,8 +59,8 @@ def get_user_by_name(name: str, session: WialonSession) -> WialonUnit | None:
|
|
|
58
59
|
}
|
|
59
60
|
)
|
|
60
61
|
if int(response.get("totalItemsCount")) == 1:
|
|
61
|
-
if
|
|
62
|
-
return
|
|
62
|
+
if user_id := int(response.get("items")[0].get("id")):
|
|
63
|
+
return WialonUser(session, user_id)
|
|
63
64
|
|
|
64
65
|
|
|
65
66
|
def get_carrier_names(session: WialonSession) -> list[str]:
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
from terminusgps.wialon.items import (
|
|
2
|
-
WialonAccount,
|
|
3
|
-
WialonResource,
|
|
4
|
-
WialonRetranslator,
|
|
5
|
-
WialonRoute,
|
|
6
|
-
WialonUnit,
|
|
7
|
-
WialonUnitGroup,
|
|
8
|
-
WialonUser,
|
|
9
|
-
)
|
|
10
|
-
from terminusgps.wialon.items.base import WialonObject
|
|
11
|
-
from terminusgps.wialon.session import WialonSession
|
|
12
|
-
|
|
13
|
-
WIALON_ITEM_MAP = {
|
|
14
|
-
"account": WialonAccount,
|
|
15
|
-
"avl_hw": None,
|
|
16
|
-
"avl_resource": WialonResource,
|
|
17
|
-
"avl_retranslator": WialonRetranslator,
|
|
18
|
-
"avl_route": WialonRoute,
|
|
19
|
-
"avl_unit": WialonUnit,
|
|
20
|
-
"avl_unit_group": WialonUnitGroup,
|
|
21
|
-
"user": WialonUser,
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class WialonObjectCreationError(Exception):
|
|
26
|
-
"""Raised when a factory fails to create a Wialon object."""
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def create_wialon_object(
|
|
30
|
-
session: WialonSession, items_type: str, *args, **kwargs
|
|
31
|
-
) -> WialonObject:
|
|
32
|
-
"""
|
|
33
|
-
Creates an ``items_type`` object in Wialon and returns it as a Python object.
|
|
34
|
-
|
|
35
|
-
:param session: A valid Wialon API session.
|
|
36
|
-
:type session: :py:obj:`~terminusgps.wialon.session.WialonSession`
|
|
37
|
-
:param items_type: A Wialon items type string.
|
|
38
|
-
:type items_type: :py:obj:`str`
|
|
39
|
-
:param args: Positional arguments to pass to the Wialon object's :py:meth:`create` method.
|
|
40
|
-
:param kwargs: Keyword arguments to pass to the Wialon object's :py:meth:`create` method.
|
|
41
|
-
:raises WialonAPIError: If something went wrong calling the Wialon API.
|
|
42
|
-
:raises WialonObjectCreationError: If something went wrong creating the object in Wialon.
|
|
43
|
-
:returns: A Wialon object.
|
|
44
|
-
:rtype: :py:obj:`~terminusgps.wialon.items.base.WialonObject`
|
|
45
|
-
|
|
46
|
-
"""
|
|
47
|
-
if items_type not in WIALON_ITEM_MAP:
|
|
48
|
-
raise ValueError(f"Unknown Wialon items type: '{items_type}'.")
|
|
49
|
-
|
|
50
|
-
cls = WIALON_ITEM_MAP.get(items_type)
|
|
51
|
-
if cls is None:
|
|
52
|
-
raise ValueError(f"Wialon items type '{items_type}' is not implemented.")
|
|
53
|
-
|
|
54
|
-
obj = cls(session)
|
|
55
|
-
obj.create(*args, **kwargs)
|
|
56
|
-
if not obj.id:
|
|
57
|
-
raise WialonObjectCreationError(
|
|
58
|
-
f"Failed to execute create({args = }, {kwargs = }) on '{obj}'."
|
|
59
|
-
)
|
|
60
|
-
return obj
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/constants.rst
RENAMED
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/controllers.rst
RENAMED
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/examples.rst
RENAMED
|
File without changes
|
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/profiles.rst
RENAMED
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/subscriptions.rst
RENAMED
|
File without changes
|
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/docs/source/authorizenet/validators.rst
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/constants.py
RENAMED
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/controllers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/subscriptions.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/authorizenet/validators.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/django/forms/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/django/forms/renderer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/items/resource.py
RENAMED
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/items/retranslator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_terminusgps-41.2.0 → python_terminusgps-41.3.0}/terminusgps/wialon/items/unit_group.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|