python-aidot 0.3.48__tar.gz → 0.3.50__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_aidot-0.3.48 → python_aidot-0.3.50}/PKG-INFO +1 -1
- {python_aidot-0.3.48 → python_aidot-0.3.50}/aidot/client.py +11 -11
- {python_aidot-0.3.48 → python_aidot-0.3.50}/aidot/device_client.py +5 -5
- {python_aidot-0.3.48 → python_aidot-0.3.50}/python_aidot.egg-info/PKG-INFO +1 -1
- {python_aidot-0.3.48 → python_aidot-0.3.50}/setup.py +1 -1
- {python_aidot-0.3.48 → python_aidot-0.3.50}/LICENSE +0 -0
- {python_aidot-0.3.48 → python_aidot-0.3.50}/README.md +0 -0
- {python_aidot-0.3.48 → python_aidot-0.3.50}/aidot/__init__.py +0 -0
- {python_aidot-0.3.48 → python_aidot-0.3.50}/aidot/aes_utils.py +0 -0
- {python_aidot-0.3.48 → python_aidot-0.3.50}/aidot/const.py +0 -0
- {python_aidot-0.3.48 → python_aidot-0.3.50}/aidot/discover.py +0 -0
- {python_aidot-0.3.48 → python_aidot-0.3.50}/aidot/exceptions.py +0 -0
- {python_aidot-0.3.48 → python_aidot-0.3.50}/aidot/login_const.py +0 -0
- {python_aidot-0.3.48 → python_aidot-0.3.50}/python_aidot.egg-info/SOURCES.txt +0 -0
- {python_aidot-0.3.48 → python_aidot-0.3.50}/python_aidot.egg-info/dependency_links.txt +0 -0
- {python_aidot-0.3.48 → python_aidot-0.3.50}/python_aidot.egg-info/requires.txt +0 -0
- {python_aidot-0.3.48 → python_aidot-0.3.50}/python_aidot.egg-info/top_level.txt +0 -0
- {python_aidot-0.3.48 → python_aidot-0.3.50}/setup.cfg +0 -0
|
@@ -77,7 +77,7 @@ class AidotClient:
|
|
|
77
77
|
password: str | None = None,
|
|
78
78
|
token: dict | None = None,
|
|
79
79
|
) -> None:
|
|
80
|
-
_LOGGER.
|
|
80
|
+
_LOGGER.warning(f"Aidot Client Version: v0.3.50")
|
|
81
81
|
self.session = session
|
|
82
82
|
self.username = username
|
|
83
83
|
self.password = password
|
|
@@ -106,19 +106,19 @@ class AidotClient:
|
|
|
106
106
|
def update_password(self, password: str) -> None:
|
|
107
107
|
self.password = password
|
|
108
108
|
|
|
109
|
-
def get_terminal_id(self) -> str:
|
|
109
|
+
async def get_terminal_id(self) -> str:
|
|
110
110
|
file_path = Path.home() / ".aidot_terminal_id"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
|
|
112
|
+
def _read_or_create() -> str:
|
|
113
|
+
if file_path.exists():
|
|
114
|
+
return file_path.read_text().strip()
|
|
114
115
|
node = uuid.getnode()
|
|
115
116
|
is_random = (node >> 40) & 1
|
|
116
|
-
|
|
117
|
-
if is_random:
|
|
118
|
-
raw_id = str(uuid.uuid4())
|
|
119
|
-
else:
|
|
120
|
-
raw_id = format(node, 'x')
|
|
117
|
+
raw_id = str(uuid.uuid4()) if is_random else format(node, "x")
|
|
121
118
|
file_path.write_text(raw_id)
|
|
119
|
+
return raw_id
|
|
120
|
+
|
|
121
|
+
raw_id = await asyncio.to_thread(_read_or_create)
|
|
122
122
|
return hashlib.md5(raw_id.encode()).hexdigest()
|
|
123
123
|
|
|
124
124
|
async def async_post_login(self) -> dict[str, Any]:
|
|
@@ -126,7 +126,7 @@ class AidotClient:
|
|
|
126
126
|
url = f"{self._base_url}/users/loginWithFreeVerification"
|
|
127
127
|
headers = {CONF_APP_ID: APP_ID, CONF_TERMINAL: "app"}
|
|
128
128
|
# f"{region}:{self.country_name.strip()}",
|
|
129
|
-
terminalId = self.get_terminal_id()
|
|
129
|
+
terminalId = await self.get_terminal_id()
|
|
130
130
|
if terminalId is None:
|
|
131
131
|
terminalId = "gvz3gjae10l4zii00t7y0"
|
|
132
132
|
data = {
|
|
@@ -152,9 +152,10 @@ class DeviceClient(object):
|
|
|
152
152
|
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
|
153
153
|
self.seq_num = 1
|
|
154
154
|
await self.login()
|
|
155
|
-
self._connect_and_login =
|
|
155
|
+
self._connect_and_login = self.status.online
|
|
156
156
|
except Exception as e:
|
|
157
157
|
self._connect_and_login = False
|
|
158
|
+
_LOGGER.warning(f"{self._TAG}:connect device error: {e}")
|
|
158
159
|
finally:
|
|
159
160
|
self._connecting = False
|
|
160
161
|
|
|
@@ -257,8 +258,7 @@ class DeviceClient(object):
|
|
|
257
258
|
raise
|
|
258
259
|
except (BrokenPipeError, ConnectionResetError, asyncio.IncompleteReadError) as e:
|
|
259
260
|
_LOGGER.error(f"{self._TAG}:read status error {e}")
|
|
260
|
-
|
|
261
|
-
syncio.get_running_loop().call_soon(
|
|
261
|
+
asyncio.get_running_loop().call_soon(
|
|
262
262
|
lambda: asyncio.create_task(self.reset())
|
|
263
263
|
)
|
|
264
264
|
return
|
|
@@ -365,7 +365,7 @@ class DeviceClient(object):
|
|
|
365
365
|
"srcAddr": "x.xxxxxxx",
|
|
366
366
|
CONF_PAYLOAD: {},
|
|
367
367
|
}
|
|
368
|
-
|
|
368
|
+
_LOGGER.info(f"{self.device_id} send_ping_action {ping}")
|
|
369
369
|
try:
|
|
370
370
|
if self.ping_count >= 3:
|
|
371
371
|
_LOGGER.error(
|
|
@@ -427,5 +427,5 @@ class DeviceClient(object):
|
|
|
427
427
|
# 10, # 10秒后重连
|
|
428
428
|
# lambda: asyncio.create_task(self.async_login())
|
|
429
429
|
# )
|
|
430
|
-
self._reconnect_handle = loop.call_later(
|
|
430
|
+
self._reconnect_handle = loop.call_later(60, self._schedule_reconnect)
|
|
431
431
|
self._login_task = asyncio.create_task(self.async_login())
|
|
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
|