python-terminusgps 1.5.8__tar.gz → 1.5.9__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.
Files changed (34) hide show
  1. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/PKG-INFO +1 -1
  2. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/pyproject.toml +1 -1
  3. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/utils.py +0 -1
  4. python_terminusgps-1.5.8/terminusgps/openstreetmap/polyline.py +0 -7
  5. python_terminusgps-1.5.8/terminusgps/openstreetmap/renderer.py +0 -3
  6. python_terminusgps-1.5.8/terminusgps/openstreetmap/session.py +0 -54
  7. python_terminusgps-1.5.8/terminusgps/wialon/__init__.py +0 -0
  8. python_terminusgps-1.5.8/terminusgps/wialon/maps/__init__.py +0 -0
  9. python_terminusgps-1.5.8/terminusgps/wialon/maps/layers.py +0 -49
  10. python_terminusgps-1.5.8/terminusgps/wialon/maps/renderer.py +0 -110
  11. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/.gitignore +0 -0
  12. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/COPYING +0 -0
  13. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/README.md +0 -0
  14. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/requirements.txt +0 -0
  15. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/__init__.py +0 -0
  16. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/authorizenet/__init__.py +0 -0
  17. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/authorizenet/auth.py +0 -0
  18. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/aws/__init__.py +0 -0
  19. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/aws/secrets.py +0 -0
  20. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/settings.py +0 -0
  21. {python_terminusgps-1.5.8/terminusgps/openstreetmap → python_terminusgps-1.5.9/terminusgps/wialon}/__init__.py +0 -0
  22. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/constants.py +0 -0
  23. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/errors.py +0 -0
  24. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/flags.py +0 -0
  25. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/items/__init__.py +0 -0
  26. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/items/base.py +0 -0
  27. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/items/resource.py +0 -0
  28. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/items/retranslator.py +0 -0
  29. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/items/route.py +0 -0
  30. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/items/unit.py +0 -0
  31. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/items/unit_group.py +0 -0
  32. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/items/user.py +0 -0
  33. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/terminusgps/wialon/session.py +0 -0
  34. {python_terminusgps-1.5.8 → python_terminusgps-1.5.9}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 1.5.8
3
+ Version: 1.5.9
4
4
  Summary: Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more.
5
5
  Project-URL: Documentation, https://app.terminusgps.com/docs/apps/python-terminusgps/index.html
6
6
  Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-terminusgps"
3
- version = "1.5.8"
3
+ version = "1.5.9"
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" } ]
@@ -50,7 +50,6 @@ def get_id_from_iccid(iccid: str, session: WialonSession) -> str | None:
50
50
  "to": 0,
51
51
  }
52
52
  )
53
- print(f"{response = }")
54
53
  if response.get("totalItemsCount", 0) != 1:
55
54
  return None
56
55
  return response["items"][0].get("id")
@@ -1,7 +0,0 @@
1
- from dataclasses import dataclass
2
-
3
-
4
- @dataclass
5
- class OpenStreetMapPolyline:
6
- key: str
7
- value: str
@@ -1,3 +0,0 @@
1
- class OpenStreetMapRenderer:
2
- def __init__(self) -> None:
3
- return
@@ -1,54 +0,0 @@
1
- import os
2
- import requests
3
- from urllib.parse import urlencode
4
-
5
-
6
- class OpenStreetMapSession:
7
- def __init__(self, client_id: str, redirect_uri: str, scopes: list[str]) -> None:
8
- self.client_id = client_id
9
- self.redirect_uri = redirect_uri
10
- self.scopes = scopes
11
- self.base_token_url = "https://master.apis.dev.openstreetmap.org/oauth2/token?"
12
- self.base_auth_url = (
13
- "https://master.apis.dev.openstreetmap.org/oauth2/authorize?"
14
- )
15
-
16
- def generate_auth_url(self) -> str:
17
- params = urlencode(
18
- {
19
- "response_type": "code",
20
- "client_id": self.client_id,
21
- "redirect_uri": self.redirect_uri,
22
- "scope": "%20".join(self.scopes),
23
- }
24
- )
25
- return self.base_auth_url + params
26
-
27
- def get_token(self, auth_code: str, client_secret: str) -> str | None:
28
- params = urlencode(
29
- {
30
- "grant_type": "authorization_code",
31
- "code": auth_code,
32
- "redirect_uri": self.redirect_uri,
33
- "client_id": self.client_id,
34
- "client_secret": client_secret,
35
- }
36
- )
37
- response = requests.post(self.base_token_url + params).json()
38
- self.scopes = [response.get("scope").split(" ")]
39
- return response.get("access_token")
40
-
41
-
42
- def main() -> None:
43
- scopes = os.getenv("OSM_SCOPES").split(" ")
44
- session = OpenStreetMapSession(
45
- client_id=os.getenv("OSM_CLIENT_ID"),
46
- redirect_uri=os.getenv("OSM_REDIRECT_URI"),
47
- scopes=scopes,
48
- )
49
- print(f"{session.generate_auth_url() = }")
50
- return
51
-
52
-
53
- if __name__ == "__main__":
54
- main()
File without changes
@@ -1,49 +0,0 @@
1
- from terminusgps.wialon.maps.renderer import WialonMapRenderer
2
-
3
-
4
- class WialonMapLayerBase:
5
- def __init__(self, renderer: WialonMapRenderer, name: str) -> None:
6
- self.renderer = renderer
7
- self.name = name
8
- self.bounds = dict()
9
-
10
- def __str__(self) -> str:
11
- return self.name
12
-
13
- def delete_layer(self) -> None:
14
- self.renderer.session.wialon_api.render_remove_layer(**{"layerName": self.name})
15
-
16
- def create_layer(self, data: list[dict], flags: int = 0x1) -> None:
17
- raise NotImplementedError("Subclasses must implement this method")
18
-
19
-
20
- class WialonMapLayerGeofence(WialonMapLayerBase):
21
- def create_layer(self, data: list[dict], flags: int = 0x1) -> None:
22
- response = self.renderer.session.wialon_api.render_create_zones_layer(
23
- **{"layerName": self.name, "flags": flags, "zones": data}
24
- )
25
- self.bounds = {
26
- "min_lat": response.get("bounds")[0],
27
- "min_lon": response.get("bounds")[1],
28
- "max_lat": response.get("bounds")[2],
29
- "max_lon": response.get("bounds")[3],
30
- }
31
-
32
-
33
- class WialonMapLayerPoi(WialonMapLayerBase):
34
- def create_layer(self, data: list[dict], flags: int = 0x1) -> None:
35
- response = self.renderer.session.wialon_api.render_create_poi_layer(
36
- **{"layerName": self.name, "flags": flags, "pois": data}
37
- )
38
- self.bounds = {
39
- "min_lat": response.get("bounds")[0],
40
- "min_lon": response.get("bounds")[1],
41
- "max_lat": response.get("bounds")[2],
42
- "max_lon": response.get("bounds")[3],
43
- }
44
-
45
-
46
- class WialonMapLayerTrack(WialonMapLayerBase):
47
- def __init__(self, **kwargs) -> None:
48
- self.units = []
49
- return super().__init__(**kwargs)
@@ -1,110 +0,0 @@
1
- from django.conf import ImproperlyConfigured, settings
2
-
3
- from terminusgps.wialon.session import WialonSession
4
-
5
-
6
- class WialonMapRenderer:
7
- def __init__(
8
- self, sid: str | None = None, gis_host: str = "hst-api.wialon.com"
9
- ) -> None:
10
- if not hasattr(settings, "WIALON_TOKEN"):
11
- raise ImproperlyConfigured("'WIALON_TOKEN' setting is required.")
12
-
13
- self.host = gis_host
14
- self.layers = []
15
- self.session = WialonSession(sid=sid)
16
-
17
- @property
18
- def total_layers(self) -> int:
19
- return len(self.layers)
20
-
21
- def get_events(self):
22
- return self.session.wialon_api.avl_evts()
23
-
24
- def toggle_layer(self, name: str, enabled: bool = True) -> None:
25
- self.session.wialon_api.render_enable_layer(
26
- **{"layerName": name, "enable": enabled}
27
- )
28
-
29
- def delete_all_layers(self) -> None:
30
- self.session.wialon_api.render_remove_all_layers({})
31
- self.layers = []
32
-
33
- def get_tiles_url(self, x: int, y: int, z: int) -> str:
34
- MIN_ZOOM, MAX_ZOOM = 2, 17
35
- z = min(max(z, MIN_ZOOM), MAX_ZOOM)
36
- return f"http://{self.host}/avl_render/{x}_{y}_{z}/{self.session.id}.png"
37
-
38
- def update_locale(
39
- self,
40
- tz: int,
41
- lang: str = "en",
42
- flags: int = 1,
43
- date_fmt: str = "%m-%E-%Y %H:%M:%S",
44
- density: int = 256 * 256,
45
- ) -> None:
46
- """
47
- Updates the renderer locale.
48
-
49
-
50
- Date Format:
51
-
52
- +-----------+------------------------------------------------------------------------+
53
- | Parameter | Description |
54
- +===========+========================================================================+
55
- | ``%H`` | The hour of the day with leading zero if required ("00" to "23") |
56
- +-----------+------------------------------------------------------------------------+
57
- | ``%B`` | The full month name ("January" to "December") |
58
- +-----------+------------------------------------------------------------------------+
59
- | ``%b`` | Abbreviated month name ("Jan" to "Dec") |
60
- +-----------+------------------------------------------------------------------------+
61
- | ``%m`` | The month of the year with leading zero if required ("01" to "12") |
62
- +-----------+------------------------------------------------------------------------+
63
- | ``%l`` | The month of the year between 1-12 ("1" to "12") |
64
- +-----------+------------------------------------------------------------------------+
65
- | ``%P`` | Format Persian calendar ("01 Farvardin 1392 00:00:00") |
66
- +-----------+------------------------------------------------------------------------+
67
- | ``%A`` | The full day name ("Monday" to "Sunday") |
68
- +-----------+------------------------------------------------------------------------+
69
- | ``%a`` | Abbreviated day name ("Mon" to "Sun") |
70
- +-----------+------------------------------------------------------------------------+
71
- | ``%E`` | The day of the month with a leading zero if required ("01" to "31") |
72
- +-----------+------------------------------------------------------------------------+
73
- | ``%e`` | The day of the month between 1 and 31 ("1" to "31") |
74
- +-----------+------------------------------------------------------------------------+
75
- | ``%I`` | The hour of the day with leading zero if required ("01" to "12") |
76
- +-----------+------------------------------------------------------------------------+
77
- | ``%M`` | The minute of the hour with leading zero if required ("00" to "59") |
78
- +-----------+------------------------------------------------------------------------+
79
- | ``%S`` | The seconds of the minute with leading zero if required ("00" to "59") |
80
- +-----------+------------------------------------------------------------------------+
81
- | ``%p`` | Displays the A.M./P.M. designator ("AM" or "PM") |
82
- +-----------+------------------------------------------------------------------------+
83
- | ``%Y`` | The full four digit year ("1999" or "2000") |
84
- +-----------+------------------------------------------------------------------------+
85
- | ``%y`` | The year as a two digit number ("99" or "00") |
86
- +-----------+------------------------------------------------------------------------+
87
-
88
- """
89
- self.session.wialon_api.render_set_locale(
90
- **{
91
- "tzOffset": tz,
92
- "language": lang,
93
- "flags": flags,
94
- "formatDate": date_fmt,
95
- "density": density,
96
- }
97
- )
98
-
99
-
100
- def main() -> None:
101
- from terminusgps.wialon.maps.layers import WialonMapLayerPoi
102
-
103
- with WialonSession() as session:
104
- renderer = WialonMapRenderer(session.id)
105
- layer = WialonMapLayerPoi(renderer, "terminusgps_office")
106
- return
107
-
108
-
109
- if __name__ == "__main__":
110
- main()