python-aidot 0.3.49__tar.gz → 0.3.51__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.49 → python_aidot-0.3.51}/PKG-INFO +1 -1
- {python_aidot-0.3.49 → python_aidot-0.3.51}/aidot/client.py +17 -14
- {python_aidot-0.3.49 → python_aidot-0.3.51}/aidot/device_client.py +4 -4
- {python_aidot-0.3.49 → python_aidot-0.3.51}/python_aidot.egg-info/PKG-INFO +1 -1
- {python_aidot-0.3.49 → python_aidot-0.3.51}/setup.py +1 -1
- {python_aidot-0.3.49 → python_aidot-0.3.51}/LICENSE +0 -0
- {python_aidot-0.3.49 → python_aidot-0.3.51}/README.md +0 -0
- {python_aidot-0.3.49 → python_aidot-0.3.51}/aidot/__init__.py +0 -0
- {python_aidot-0.3.49 → python_aidot-0.3.51}/aidot/aes_utils.py +0 -0
- {python_aidot-0.3.49 → python_aidot-0.3.51}/aidot/const.py +0 -0
- {python_aidot-0.3.49 → python_aidot-0.3.51}/aidot/discover.py +0 -0
- {python_aidot-0.3.49 → python_aidot-0.3.51}/aidot/exceptions.py +0 -0
- {python_aidot-0.3.49 → python_aidot-0.3.51}/aidot/login_const.py +0 -0
- {python_aidot-0.3.49 → python_aidot-0.3.51}/python_aidot.egg-info/SOURCES.txt +0 -0
- {python_aidot-0.3.49 → python_aidot-0.3.51}/python_aidot.egg-info/dependency_links.txt +0 -0
- {python_aidot-0.3.49 → python_aidot-0.3.51}/python_aidot.egg-info/requires.txt +0 -0
- {python_aidot-0.3.49 → python_aidot-0.3.51}/python_aidot.egg-info/top_level.txt +0 -0
- {python_aidot-0.3.49 → python_aidot-0.3.51}/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.warning(f"Aidot Client Version: v0.3.
|
|
80
|
+
_LOGGER.warning(f"Aidot Client Version: v0.3.51")
|
|
81
81
|
self.session = session
|
|
82
82
|
self.username = username
|
|
83
83
|
self.password = password
|
|
@@ -106,19 +106,22 @@ 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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
raw_id = str(uuid.uuid4())
|
|
119
|
-
|
|
120
|
-
raw_id
|
|
121
|
-
|
|
111
|
+
|
|
112
|
+
def _read_or_create() -> str:
|
|
113
|
+
try:
|
|
114
|
+
if file_path.exists():
|
|
115
|
+
return file_path.read_text().strip()
|
|
116
|
+
node = uuid.getnode()
|
|
117
|
+
is_random = (node >> 40) & 1
|
|
118
|
+
raw_id = str(uuid.uuid4()) if is_random else format(node, "x")
|
|
119
|
+
file_path.write_text(raw_id)
|
|
120
|
+
return raw_id
|
|
121
|
+
except OSError:
|
|
122
|
+
return 'gvz3gjae10l4zii00t7y0'
|
|
123
|
+
|
|
124
|
+
raw_id = await asyncio.to_thread(_read_or_create)
|
|
122
125
|
return hashlib.md5(raw_id.encode()).hexdigest()
|
|
123
126
|
|
|
124
127
|
async def async_post_login(self) -> dict[str, Any]:
|
|
@@ -126,7 +129,7 @@ class AidotClient:
|
|
|
126
129
|
url = f"{self._base_url}/users/loginWithFreeVerification"
|
|
127
130
|
headers = {CONF_APP_ID: APP_ID, CONF_TERMINAL: "app"}
|
|
128
131
|
# f"{region}:{self.country_name.strip()}",
|
|
129
|
-
terminalId = self.get_terminal_id()
|
|
132
|
+
terminalId = await self.get_terminal_id()
|
|
130
133
|
if terminalId is None:
|
|
131
134
|
terminalId = "gvz3gjae10l4zii00t7y0"
|
|
132
135
|
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,7 +258,6 @@ 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
|
-
# await self.reset()
|
|
261
261
|
asyncio.get_running_loop().call_soon(
|
|
262
262
|
lambda: asyncio.create_task(self.reset())
|
|
263
263
|
)
|
|
@@ -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
|