tplinkrouterc6u 4.2.2__py3-none-any.whl → 4.2.3__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.
test/test_client_deco.py CHANGED
@@ -71,7 +71,7 @@ class TestTPLinkDecoClient(TestCase):
71
71
  "online": true, "name": "d2lyZWxlc3M0", "enable_priority": false, "remain_time": 0, "owner_id": "",
72
72
  "client_type": "other", "interface": "guest"},
73
73
  {"mac": "56:32:c3:de:ce:f0", "up_speed": 3, "down_speed": 1, "wire_type": "wireless", "access_host": "1",
74
- "connection_type": "band2_4", "space_id": "1", "ip": "192.168.68.105", "client_mesh": true,
74
+ "connection_type": "band2_4", "space_id": "1", "ip": "UNKNOWN", "client_mesh": true,
75
75
  "online": true, "name": "d2lyZWxlc3M1", "enable_priority": false, "remain_time": 0, "owner_id": "",
76
76
  "client_type": "other", "interface": "guest"}
77
77
  ]}, "error_code": 0}
@@ -150,7 +150,7 @@ class TestTPLinkDecoClient(TestCase):
150
150
  self.assertIsInstance(status.devices[4], Device)
151
151
  self.assertEqual(status.devices[4].type, Connection.GUEST_2G)
152
152
  self.assertEqual(status.devices[4].macaddr, '56-32-C3-DE-CE-F0')
153
- self.assertEqual(status.devices[4].ipaddr, '192.168.68.105')
153
+ self.assertEqual(status.devices[4].ipaddr, '0.0.0.0')
154
154
  self.assertEqual(status.devices[4].hostname, 'wireless5')
155
155
  self.assertEqual(status.devices[4].packets_sent, None)
156
156
  self.assertEqual(status.devices[4].packets_received, None)
@@ -6,7 +6,7 @@ from tplinkrouterc6u.client import (
6
6
  AbstractRouter,
7
7
  TPLinkDecoClient,
8
8
  )
9
- from tplinkrouterc6u.enum import Connection
9
+ from tplinkrouterc6u.package_enum import Connection
10
10
  from tplinkrouterc6u.dataclass import (
11
11
  Firmware,
12
12
  Status,
tplinkrouterc6u/client.py CHANGED
@@ -10,8 +10,9 @@ from datetime import timedelta
10
10
  from macaddress import EUI48
11
11
  from ipaddress import IPv4Address
12
12
  from logging import Logger
13
+ from tplinkrouterc6u.helper import get_ip
13
14
  from tplinkrouterc6u.encryption import EncryptionWrapper, EncryptionWrapperMR
14
- from tplinkrouterc6u.enum import Connection
15
+ from tplinkrouterc6u.package_enum import Connection
15
16
  from tplinkrouterc6u.dataclass import Firmware, Status, Device, IPv4Reservation, IPv4DHCPLease, IPv4Status
16
17
  from tplinkrouterc6u.exception import ClientException, ClientError
17
18
  from abc import ABC, abstractmethod
@@ -353,15 +354,9 @@ class TplinkBaseRouter(AbstractRouter, TplinkRequest):
353
354
 
354
355
  devices = {}
355
356
 
356
- def _getIP(ip: str) -> IPv4Address:
357
- try:
358
- return IPv4Address(ip)
359
- except Exception:
360
- return IPv4Address('0.0.0.0')
361
-
362
357
  def _add_device(conn: Connection, item: dict) -> None:
363
358
  devices[item['macaddr']] = Device(conn, EUI48(item['macaddr']),
364
- _getIP(item['ipaddr']),
359
+ get_ip(item['ipaddr']),
365
360
  item['hostname'])
366
361
 
367
362
  for item in data.get('access_devices_wired', []):
@@ -387,7 +382,7 @@ class TplinkBaseRouter(AbstractRouter, TplinkRequest):
387
382
  for item in smart_network:
388
383
  if item['mac'] not in devices:
389
384
  conn = self._map_wire_type(item.get('deviceTag'), not item.get('isGuest'))
390
- devices[item['mac']] = Device(conn, EUI48(item['mac']), _getIP(item['ip']),
385
+ devices[item['mac']] = Device(conn, EUI48(item['mac']), get_ip(item['ip']),
391
386
  item['deviceName'])
392
387
  if conn.is_iot():
393
388
  if status.iot_clients_total is None:
@@ -585,10 +580,9 @@ class TPLinkDecoClient(TplinkEncryption, AbstractRouter):
585
580
  status.iot_clients_total = 0
586
581
  status.iot_clients_total += 1
587
582
 
588
- ip = item['ip'] if item.get('ip') else '0.0.0.0'
589
583
  device = Device(conn,
590
584
  EUI48(item['mac']),
591
- IPv4Address(ip),
585
+ get_ip(item.get('ip', '0.0.0.0')),
592
586
  b64decode(item['name']).decode())
593
587
  device.down_speed = item.get('down_speed')
594
588
  device.up_speed = item.get('up_speed')
@@ -1131,7 +1125,7 @@ class TPLinkMRClient(AbstractRouter):
1131
1125
  lines = response.split('\n')
1132
1126
  for line in lines:
1133
1127
  if line.startswith('['):
1134
- regexp = search('\[\d,\d,\d,\d,\d,\d\](\d)', line)
1128
+ regexp = search(r'\[\d,\d,\d,\d,\d,\d\](\d)', line)
1135
1129
  if regexp is not None:
1136
1130
  obj = {}
1137
1131
  index = regexp.group(1)
@@ -1321,7 +1315,7 @@ class TPLinkMRClient(AbstractRouter):
1321
1315
  Return value:
1322
1316
  return code (int)
1323
1317
  '''
1324
- result = search('\$\.ret=(.*);', response_text)
1318
+ result = search(r'\$\.ret=(.*);', response_text)
1325
1319
  assert result is not None
1326
1320
  assert result.group(1).isnumeric()
1327
1321
 
@@ -1,7 +1,7 @@
1
1
  from macaddress import EUI48
2
2
  from ipaddress import IPv4Address
3
3
  from dataclasses import dataclass
4
- from tplinkrouterc6u.enum import Connection
4
+ from tplinkrouterc6u.package_enum import Connection
5
5
 
6
6
 
7
7
  @dataclass
@@ -0,0 +1,8 @@
1
+ from ipaddress import IPv4Address
2
+
3
+
4
+ def get_ip(ip: str) -> IPv4Address:
5
+ try:
6
+ return IPv4Address(ip)
7
+ except Exception:
8
+ return IPv4Address('0.0.0.0')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tplinkrouterc6u
3
- Version: 4.2.2
3
+ Version: 4.2.3
4
4
  Summary: TP-Link Router API
5
5
  Home-page: https://github.com/AlexandrErohin/TP-Link-Archer-C6U
6
6
  Author: Alex Erohin
@@ -225,6 +225,7 @@ or you have TP-link C1200 V2 or similar router you need to get web encrypted pas
225
225
  ## <a id="supports">Supported routers</a>
226
226
  ### Fully tested Hardware Versions
227
227
  - Archer A7 V5
228
+ - Archer A9 V6
228
229
  - Archer AX10 v1.0
229
230
  - Archer AX12 v1.0
230
231
  - Archer AX20 v1.0
@@ -237,6 +238,7 @@ or you have TP-link C1200 V2 or similar router you need to get web encrypted pas
237
238
  - Archer AX72 V1
238
239
  - Archer AX73 V1
239
240
  - Archer AX75 V1
241
+ - Archer AX90 V1.20
240
242
  - Archer AXE75 V1
241
243
  - Archer AXE16000
242
244
  - Archer AX3000 V1
@@ -252,7 +254,7 @@ or you have TP-link C1200 V2 or similar router you need to get web encrypted pas
252
254
  - Archer C5400X V1
253
255
  - Archer GX90 v1.0
254
256
  - Archer MR200 (v5, v5.3)
255
- - Archer MR600 (v1, v3)
257
+ - Archer MR600 (v1, v2, v3)
256
258
  - Archer VR2100v v1
257
259
  - Archer VR900v
258
260
  - Deco M4 2.0
@@ -270,15 +272,14 @@ or you have TP-link C1200 V2 or similar router you need to get web encrypted pas
270
272
  - TL-MR100 v2.0
271
273
  - TL-MR105
272
274
  - TL-MR6400 (v5, v5.3)
275
+ - TL-MR6500v
273
276
  - TL-WA3001 v1.0
274
277
 
275
278
  ### Not fully tested Hardware Versions
276
279
  - AD7200 V2
277
280
  - Archer A6 (V2 and V3)
278
- - Archer A9 V6
279
281
  - Archer A10 (V1 and V2)
280
282
  - Archer A20 (V1, V3)
281
- - Archer C7 V4
282
283
  - Archer C8 (V3 and V4)
283
284
  - Archer C9 (V4 and V5)
284
285
  - Archer C59 V2
@@ -0,0 +1,17 @@
1
+ test/__init__.py,sha256=McQmUjeN3AwmwdS6QNfwGXXE77OKoPK852I2BM9XsrU,210
2
+ test/test_client.py,sha256=8cK4qnheszu-zpUJqttKp5Z5WJXrQy1t_fMzMzNnmvw,30638
3
+ test/test_client_c1200.py,sha256=O6NK9uXIEb_vks6lI3g7j6q8TYJ9MSDFYzGA_wOBhOA,4620
4
+ test/test_client_deco.py,sha256=OqJ9e6_TcX60Ccqj_UH9AQ3Ty25hfdbtPvtzLnWpMn0,30464
5
+ test/test_client_mr.py,sha256=znDA8PBxHOGKbZHzsyERbEEWjkP0U5KpV8Z-kaRnXIM,23046
6
+ tplinkrouterc6u/__init__.py,sha256=EpcrPHORAk_m76WDHMLea_RzCPjqZYAs_774JZChLGs,410
7
+ tplinkrouterc6u/client.py,sha256=dUV4jbx_r4RP_vjvUePxjaZ5LW1D1hJ9BtISWXlPIqM,51458
8
+ tplinkrouterc6u/dataclass.py,sha256=SuAOqKun_ThaeUEa8F9wi6qu4ucUatYMzebo39Kk10s,6617
9
+ tplinkrouterc6u/encryption.py,sha256=2InKlHLQSWkcI8yP8EIGSG-bGXft_KU-bplGjcoeE-k,5546
10
+ tplinkrouterc6u/exception.py,sha256=PUTPsadxiylQhIRUMfkN1RWXh07cHmdav9Pdgxs3Lmw,90
11
+ tplinkrouterc6u/helper.py,sha256=mbPkS_9GfOYMxEIx-q-xLlupR0-m_MDgCWQgx8xxOA8,172
12
+ tplinkrouterc6u/package_enum.py,sha256=bqmnu4gQMEntMCgsya2R7dRcrSJIDPWMj8vNN6JxeME,1382
13
+ tplinkrouterc6u-4.2.3.dist-info/LICENSE,sha256=YF6QR6Vjxcg5b_sYIyqkME7FZYau5TfEUGTG-0JeRK0,35129
14
+ tplinkrouterc6u-4.2.3.dist-info/METADATA,sha256=v6KaqYCwRYqjwvMouDqkLgbp0_X9nz4y1K-qcMoTh4Y,13058
15
+ tplinkrouterc6u-4.2.3.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
16
+ tplinkrouterc6u-4.2.3.dist-info/top_level.txt,sha256=1iSCCIueqgEkrTxtQ-jiHe99jAB10zqrVdBcwvNfe_M,21
17
+ tplinkrouterc6u-4.2.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,16 +0,0 @@
1
- test/__init__.py,sha256=McQmUjeN3AwmwdS6QNfwGXXE77OKoPK852I2BM9XsrU,210
2
- test/test_client.py,sha256=8cK4qnheszu-zpUJqttKp5Z5WJXrQy1t_fMzMzNnmvw,30638
3
- test/test_client_c1200.py,sha256=O6NK9uXIEb_vks6lI3g7j6q8TYJ9MSDFYzGA_wOBhOA,4620
4
- test/test_client_deco.py,sha256=8mo_9KEqVBsrazBHaGUdQTIsSvXcHtCT-l7MBxXSP3o,30478
5
- test/test_client_mr.py,sha256=znDA8PBxHOGKbZHzsyERbEEWjkP0U5KpV8Z-kaRnXIM,23046
6
- tplinkrouterc6u/__init__.py,sha256=CECjWGaoM8ABX3-95GUa4Xg9DCKzX2k8IprPg1fvnYw,402
7
- tplinkrouterc6u/client.py,sha256=7-S8FFD9ML5qHT0-7mzb-FQhmcmytNlB0J778235N4Q,51626
8
- tplinkrouterc6u/dataclass.py,sha256=VVLeWzH6_HYvjiw31aWisW5w8UTgiojWTgnQB7Tb5eM,6609
9
- tplinkrouterc6u/encryption.py,sha256=2InKlHLQSWkcI8yP8EIGSG-bGXft_KU-bplGjcoeE-k,5546
10
- tplinkrouterc6u/enum.py,sha256=bqmnu4gQMEntMCgsya2R7dRcrSJIDPWMj8vNN6JxeME,1382
11
- tplinkrouterc6u/exception.py,sha256=PUTPsadxiylQhIRUMfkN1RWXh07cHmdav9Pdgxs3Lmw,90
12
- tplinkrouterc6u-4.2.2.dist-info/LICENSE,sha256=YF6QR6Vjxcg5b_sYIyqkME7FZYau5TfEUGTG-0JeRK0,35129
13
- tplinkrouterc6u-4.2.2.dist-info/METADATA,sha256=50OdAco8AZW3sdxHol7OuMlVYU56h_cQiws-XjG6kFY,13036
14
- tplinkrouterc6u-4.2.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
15
- tplinkrouterc6u-4.2.2.dist-info/top_level.txt,sha256=1iSCCIueqgEkrTxtQ-jiHe99jAB10zqrVdBcwvNfe_M,21
16
- tplinkrouterc6u-4.2.2.dist-info/RECORD,,
File without changes