python-terminusgps 31.7.1__py3-none-any.whl → 31.7.2__py3-none-any.whl

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.

Potentially problematic release.


This version of python-terminusgps might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 31.7.1
3
+ Version: 31.7.2
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
@@ -30,8 +30,7 @@ terminusgps/twilio/tests/test_validators.py,sha256=CETv7Mcr19UMMfh1UaWSV26FiOeh2
30
30
  terminusgps/wialon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  terminusgps/wialon/constants.py,sha256=Ju2XL2A4DPFD-w8NjYqEfnnqregl1luPT0XGhGSUnO8,6316
32
32
  terminusgps/wialon/flags.py,sha256=M50EdhxQ8IMnJnU0mrHK7-h8Asc6tvNiTOOfd1dBW6A,12815
33
- terminusgps/wialon/logger.py,sha256=nUBsaLMaffSaAHGHAM6mFXDzix9hbNecVtA3INVtii8,968
34
- terminusgps/wialon/session.py,sha256=Ata_eDn4fzTkvl0A1MNHwlFx-G9aVayXMo40lcS3pY4,10007
33
+ terminusgps/wialon/session.py,sha256=09WYWvON_H844IFfdt7_x1we6tHhQSkt9K_BEedBjv0,10396
35
34
  terminusgps/wialon/utils.py,sha256=JWHZ7VEeo8VNBH67gjOAQk5ITKuPllWDlJ4dVSQ5blA,11002
36
35
  terminusgps/wialon/validators.py,sha256=CVEpFsxqplEcpv4U2ipA6v9y5cSrMKFUXLvze-3vs4U,4223
37
36
  terminusgps/wialon/items/__init__.py,sha256=3BVthghekMvhMQSzQgBMlD_phxmKSmp3Zvmo-z0O8Bs,211
@@ -45,8 +44,8 @@ terminusgps/wialon/items/user.py,sha256=5LgwalGO8KS_7psmAVmAlnC0S6SPBDZMOuT5ZqPK
45
44
  terminusgps/wialon/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
45
  terminusgps/wialon/tests/test_items.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
46
  terminusgps/wialon/tests/test_session.py,sha256=9mBlYchMo9NeqRIZsmxYzrM1zBHorqu4ooxqSNppLpI,1336
48
- terminusgps/wialon/tests/test_utils.py,sha256=dEcGDP_mVbT_uEMfdodAxc6Dcehn_ZwZswp8nYtdNvA,1669
49
- python_terminusgps-31.7.1.dist-info/METADATA,sha256=nph4QwpwpHjYR-rz25kOtOlWPuMvvu5t_YsBzq0QtT8,1581
50
- python_terminusgps-31.7.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
51
- python_terminusgps-31.7.1.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
52
- python_terminusgps-31.7.1.dist-info/RECORD,,
47
+ terminusgps/wialon/tests/test_utils.py,sha256=SK4PxJQGECFnzx_EQeRAQfsQ5_3FLaVcis2W9u_ibuI,1730
48
+ python_terminusgps-31.7.2.dist-info/METADATA,sha256=t9yLXs5VwoG9MV9BpmEvx5HCt-MpX2cjXumX4lT0M10,1581
49
+ python_terminusgps-31.7.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
50
+ python_terminusgps-31.7.2.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
51
+ python_terminusgps-31.7.2.dist-info/RECORD,,
@@ -1,6 +1,5 @@
1
1
  import dataclasses
2
2
  import datetime
3
- import logging
4
3
  import typing
5
4
 
6
5
  import wialon.api
@@ -20,10 +19,17 @@ class WialonAPICall:
20
19
 
21
20
 
22
21
  class Wialon(wialon.api.Wialon):
23
- def __init__(self, log_level: int = logging.INFO, *args, **kwargs) -> None:
22
+ def __init__(
23
+ self, log_level: int = 10, log_days: int = 10, *args, **kwargs
24
+ ) -> None:
24
25
  super().__init__(*args, **kwargs)
25
26
  self.call_history: list[WialonAPICall] = []
26
- logger.add(self.__class__.__name__, level=log_level)
27
+ logger.add(
28
+ f"logs/{self.__class__.__name__}.log",
29
+ level=log_level,
30
+ retention=f"{log_days} days",
31
+ diagnose=settings.DEBUG,
32
+ )
27
33
 
28
34
  @property
29
35
  def total_calls(self) -> int:
@@ -60,7 +66,8 @@ class WialonSession:
60
66
  scheme: str = "https",
61
67
  host: str = "hst-api.wialon.com",
62
68
  port: int = 443,
63
- log_level: int = logging.INFO,
69
+ log_level: int = 10,
70
+ log_days: int = 10,
64
71
  ) -> None:
65
72
  """
66
73
  Starts or continues a Wialon API session.
@@ -75,21 +82,33 @@ class WialonSession:
75
82
  :type host: :py:obj:`str`
76
83
  :param port: Wialon API host port. Default is ``443``.
77
84
  :type port: :py:obj:`int`
78
- :param log_level: Level of emitted logs. Default is :py:obj:`~logging.INFO`.
85
+ :param log_level: Level of emitted logs. Default is ``10``.
79
86
  :type log_level: :py:obj:`int`
80
87
  :returns: Nothing.
81
88
  :rtype: :py:obj:`None`
82
89
 
83
90
  """
84
91
 
85
- logger.add(self.__class__.__name__, level=log_level)
92
+ logger.add(
93
+ f"logs/{self.__class__.__name__}.log",
94
+ level=log_level,
95
+ retention=f"{log_days} days",
96
+ diagnose=settings.DEBUG,
97
+ )
86
98
  self._token = token or settings.WIALON_TOKEN
87
99
  self._username = None
88
100
  self._gis_sid = None
89
101
  self._hw_gp_ip = None
90
102
  self._wsdk_version = None
91
103
  self._uid = None
92
- self.wialon_api = Wialon(scheme=scheme, host=host, port=port, sid=sid)
104
+ self.wialon_api = Wialon(
105
+ scheme=scheme,
106
+ host=host,
107
+ port=port,
108
+ sid=sid,
109
+ log_level=log_level,
110
+ log_days=log_days,
111
+ )
93
112
 
94
113
  def __str__(self) -> str:
95
114
  return str(self.id)
@@ -1,7 +1,7 @@
1
1
  import string
2
2
  import unittest
3
3
 
4
- from .. import utils
4
+ from terminusgps.wialon import utils
5
5
 
6
6
 
7
7
  class WialonUtilsTestCase(unittest.TestCase):
@@ -34,6 +34,7 @@ class WialonUtilsTestCase(unittest.TestCase):
34
34
  self.fail("Generated password did not contain an uppercase letter.")
35
35
  if not any([c for c in password if c in s1]):
36
36
  self.fail("Generated password did not contain a lowercase letter.")
37
+ # TODO: Make this check for 3 digits
37
38
  if not any([c for c in password if c in s2]):
38
39
  self.fail("Generated password did not contain a digit.")
39
40
  if not any([c for c in password if c in s3]):
@@ -1,29 +0,0 @@
1
- import logging
2
-
3
-
4
- class WialonLogger:
5
- def __init__(
6
- self,
7
- logger: logging.Logger,
8
- level: int = logging.DEBUG,
9
- format: str = "%(name)s - %(levelname)s - %(asctime)s - %(message)s",
10
- use_stream_handler: bool = True,
11
- use_file_handler: bool = False,
12
- filename: str = "wialon_debug.log",
13
- ) -> None:
14
- self.logger = logger
15
- self.logger.setLevel(level)
16
- formatter = logging.Formatter(format)
17
-
18
- if use_stream_handler and not self.logger.handlers:
19
- stream_handler = logging.StreamHandler()
20
- stream_handler.setFormatter(formatter)
21
- self.logger.addHandler(stream_handler)
22
-
23
- if use_file_handler and not self.logger.handlers:
24
- file_handler = logging.FileHandler(filename)
25
- file_handler.setFormatter(formatter)
26
- self.logger.addHandler(file_handler)
27
-
28
- def get_logger(self) -> logging.Logger:
29
- return self.logger