tplinkrouterc6u 5.6.1__tar.gz → 5.7.0__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 (37) hide show
  1. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/PKG-INFO +11 -5
  2. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/README.md +8 -3
  3. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/setup.py +1 -1
  4. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/test/test_client_c6u.py +5 -0
  5. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/test/test_client_c80.py +6 -0
  6. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/test/test_client_mr.py +0 -2
  7. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/client/c80.py +1 -0
  8. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/client/deco.py +18 -0
  9. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/common/dataclass.py +1 -0
  10. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u.egg-info/PKG-INFO +11 -5
  11. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/LICENSE +0 -0
  12. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/setup.cfg +0 -0
  13. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/test/__init__.py +0 -0
  14. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/test/test_client_c1200.py +0 -0
  15. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/test/test_client_deco.py +0 -0
  16. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/test/test_client_ex.py +0 -0
  17. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/test/test_client_xdr.py +0 -0
  18. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/__init__.py +0 -0
  19. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/client/__init__.py +0 -0
  20. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/client/c1200.py +0 -0
  21. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/client/c5400x.py +0 -0
  22. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/client/c6u.py +0 -0
  23. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/client/ex.py +0 -0
  24. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/client/mr.py +0 -0
  25. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/client/vr.py +0 -0
  26. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/client/xdr.py +0 -0
  27. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/client_abstract.py +0 -0
  28. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/common/__init__.py +0 -0
  29. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/common/encryption.py +0 -0
  30. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/common/exception.py +0 -0
  31. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/common/helper.py +0 -0
  32. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/common/package_enum.py +0 -0
  33. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u/provider.py +0 -0
  34. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u.egg-info/SOURCES.txt +0 -0
  35. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u.egg-info/dependency_links.txt +0 -0
  36. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u.egg-info/requires.txt +0 -0
  37. {tplinkrouterc6u-5.6.1 → tplinkrouterc6u-5.7.0}/tplinkrouterc6u.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: tplinkrouterc6u
3
- Version: 5.6.1
3
+ Version: 5.7.0
4
4
  Summary: TP-Link Router API (supports also Mercusys Router)
5
5
  Home-page: https://github.com/AlexandrErohin/TP-Link-Archer-C6U
6
6
  Author: Alex Erohin
@@ -25,6 +25,7 @@ Dynamic: classifier
25
25
  Dynamic: description
26
26
  Dynamic: description-content-type
27
27
  Dynamic: home-page
28
+ Dynamic: license-file
28
29
  Dynamic: requires-dist
29
30
  Dynamic: requires-python
30
31
  Dynamic: summary
@@ -186,6 +187,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
186
187
  | down_speed | download speed | int, None |
187
188
  | up_speed | upload speed | int, None |
188
189
  | signal | Signal strength | int, None |
190
+ | active | Is active device | bool |
189
191
 
190
192
  ### <a id="IPv4Reservation">IPv4Reservation</a>
191
193
  | Field | Description | Type |
@@ -288,12 +290,12 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
288
290
  - [MERCUSYS routers](#mercusys)
289
291
  ### <a id="tplink">TP-LINK routers</a>
290
292
  - Archer A7 V5
291
- - Archer A8 1.0
293
+ - Archer A8 (1.0, 2.20)
292
294
  - Archer A9 V6
295
+ - Archer A20 v1.0
293
296
  - Archer AX10 v1.0
294
297
  - Archer AX12 v1.0
295
- - Archer AX20 v1.0
296
- - Archer AX20 v3.0
298
+ - Archer AX20 (v1.0, v3.0)
297
299
  - Archer AX21 (v1.20, v3.0)
298
300
  - Archer AX23 (v1.0, v1.2)
299
301
  - Archer AX50 v1.0
@@ -317,6 +319,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
317
319
  - Archer C6 (v2.0, v3.0, 4.0)
318
320
  - Archer C6U v1.0
319
321
  - Archer C7 (v4.0, v5.0)
322
+ - Archer C24 (1.0, 2.0)
320
323
  - Archer C60 v2.0
321
324
  - Archer C80 (1.0, 2.20)
322
325
  - Archer C5400X V1
@@ -337,6 +340,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
337
340
  - Deco P7
338
341
  - Deco X20
339
342
  - Deco X50 v1.3
343
+ - Deco X55 1.0
340
344
  - Deco X60 V3
341
345
  - Deco X90
342
346
  - Deco XE75 (v1.0, v2.0)
@@ -349,11 +353,13 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
349
353
  - TL-MR105
350
354
  - TL-MR6400 (v5, v5.3)
351
355
  - TL-MR6500v
356
+ - TL-WA1201 3.0
352
357
  - TL-WA3001 v1.0
353
358
  - TL-XDR3010 V2
354
359
  - XC220-G3v v2.30
355
360
  ### <a id="mercusys">MERCUSYS routers</a>
356
361
  - MR47BE v1.0
362
+ - MR50G 1.0
357
363
  - H60XR 1.0
358
364
 
359
365
  Please let me know if you have tested integration with any other model. Open an issue with info about router's model, hardware and firmware versions.
@@ -155,6 +155,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
155
155
  | down_speed | download speed | int, None |
156
156
  | up_speed | upload speed | int, None |
157
157
  | signal | Signal strength | int, None |
158
+ | active | Is active device | bool |
158
159
 
159
160
  ### <a id="IPv4Reservation">IPv4Reservation</a>
160
161
  | Field | Description | Type |
@@ -257,12 +258,12 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
257
258
  - [MERCUSYS routers](#mercusys)
258
259
  ### <a id="tplink">TP-LINK routers</a>
259
260
  - Archer A7 V5
260
- - Archer A8 1.0
261
+ - Archer A8 (1.0, 2.20)
261
262
  - Archer A9 V6
263
+ - Archer A20 v1.0
262
264
  - Archer AX10 v1.0
263
265
  - Archer AX12 v1.0
264
- - Archer AX20 v1.0
265
- - Archer AX20 v3.0
266
+ - Archer AX20 (v1.0, v3.0)
266
267
  - Archer AX21 (v1.20, v3.0)
267
268
  - Archer AX23 (v1.0, v1.2)
268
269
  - Archer AX50 v1.0
@@ -286,6 +287,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
286
287
  - Archer C6 (v2.0, v3.0, 4.0)
287
288
  - Archer C6U v1.0
288
289
  - Archer C7 (v4.0, v5.0)
290
+ - Archer C24 (1.0, 2.0)
289
291
  - Archer C60 v2.0
290
292
  - Archer C80 (1.0, 2.20)
291
293
  - Archer C5400X V1
@@ -306,6 +308,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
306
308
  - Deco P7
307
309
  - Deco X20
308
310
  - Deco X50 v1.3
311
+ - Deco X55 1.0
309
312
  - Deco X60 V3
310
313
  - Deco X90
311
314
  - Deco XE75 (v1.0, v2.0)
@@ -318,11 +321,13 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
318
321
  - TL-MR105
319
322
  - TL-MR6400 (v5, v5.3)
320
323
  - TL-MR6500v
324
+ - TL-WA1201 3.0
321
325
  - TL-WA3001 v1.0
322
326
  - TL-XDR3010 V2
323
327
  - XC220-G3v v2.30
324
328
  ### <a id="mercusys">MERCUSYS routers</a>
325
329
  - MR47BE v1.0
330
+ - MR50G 1.0
326
331
  - H60XR 1.0
327
332
 
328
333
  Please let me know if you have tested integration with any other model. Open an issue with info about router's model, hardware and firmware versions.
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="tplinkrouterc6u",
8
- version="5.6.1",
8
+ version="5.7.0",
9
9
  author="Alex Erohin",
10
10
  author_email="alexanderErohin@yandex.ru",
11
11
  description="TP-Link Router API (supports also Mercusys Router)",
@@ -257,6 +257,7 @@ class TestTPLinkClient(TestCase):
257
257
  self.assertEqual(status.devices[0].hostname, 'SERVER')
258
258
  self.assertEqual(status.devices[0].packets_sent, None)
259
259
  self.assertEqual(status.devices[0].packets_received, None)
260
+ self.assertEqual(status.devices[0].active, True)
260
261
  self.assertIsInstance(status.devices[0], Device)
261
262
  self.assertEqual(status.devices[1].type, Connection.WIRED)
262
263
  self.assertEqual(status.devices[1].macaddr, 'AC-04-D6-25-2A-96')
@@ -266,6 +267,7 @@ class TestTPLinkClient(TestCase):
266
267
  self.assertEqual(status.devices[1].hostname, 'UNKNOWN')
267
268
  self.assertEqual(status.devices[1].packets_sent, None)
268
269
  self.assertEqual(status.devices[1].packets_received, None)
270
+ self.assertEqual(status.devices[1].active, True)
269
271
  self.assertIsInstance(status.devices[2], Device)
270
272
  self.assertEqual(status.devices[2].type, Connection.HOST_2G)
271
273
  self.assertEqual(status.devices[2].macaddr, '06-82-9D-2B-8F-C6')
@@ -273,6 +275,7 @@ class TestTPLinkClient(TestCase):
273
275
  self.assertEqual(status.devices[2].hostname, 'UNKNOWN')
274
276
  self.assertEqual(status.devices[2].packets_sent, 450333)
275
277
  self.assertEqual(status.devices[2].packets_received, 4867482)
278
+ self.assertEqual(status.devices[2].active, True)
276
279
  self.assertIsInstance(status.devices[3], Device)
277
280
  self.assertEqual(status.devices[3].type, Connection.HOST_2G)
278
281
  self.assertEqual(status.devices[3].macaddr, '06-55-9D-2B-8F-A7')
@@ -280,6 +283,7 @@ class TestTPLinkClient(TestCase):
280
283
  self.assertEqual(status.devices[3].hostname, 'Unknown')
281
284
  self.assertEqual(status.devices[3].packets_sent, None)
282
285
  self.assertEqual(status.devices[3].packets_received, None)
286
+ self.assertEqual(status.devices[3].active, True)
283
287
  self.assertIsInstance(status.devices[4], Device)
284
288
  self.assertEqual(status.devices[4].type, Connection.HOST_5G)
285
289
  self.assertEqual(status.devices[4].macaddr, '1F-7A-BD-F7-20-0D')
@@ -287,6 +291,7 @@ class TestTPLinkClient(TestCase):
287
291
  self.assertEqual(status.devices[4].hostname, '')
288
292
  self.assertEqual(status.devices[4].packets_sent, 134815)
289
293
  self.assertEqual(status.devices[4].packets_received, 2953078)
294
+ self.assertEqual(status.devices[4].active, True)
290
295
 
291
296
  def test_get_status_ax_55(self) -> None:
292
297
  response_status = '''
@@ -474,6 +474,7 @@ class TestTPLinkClient(TestCase):
474
474
  self.assertEqual(device.hostname, 'Laptop')
475
475
  self.assertEqual(device.up_speed, 0)
476
476
  self.assertEqual(device.down_speed, 0)
477
+ self.assertEqual(device.active, False)
477
478
 
478
479
  device = status.devices[1]
479
480
  self.assertIsInstance(device, Device)
@@ -485,6 +486,7 @@ class TestTPLinkClient(TestCase):
485
486
  self.assertEqual(device.hostname, 'iPhone')
486
487
  self.assertEqual(device.up_speed, 0)
487
488
  self.assertEqual(device.down_speed, 0)
489
+ self.assertEqual(device.active, False)
488
490
 
489
491
  device = status.devices[2]
490
492
  self.assertIsInstance(device, Device)
@@ -496,6 +498,7 @@ class TestTPLinkClient(TestCase):
496
498
  self.assertEqual(device.hostname, 'Laptop2')
497
499
  self.assertEqual(device.up_speed, 30)
498
500
  self.assertEqual(device.down_speed, 200)
501
+ self.assertEqual(device.active, True)
499
502
 
500
503
  device = status.devices[3]
501
504
  self.assertIsInstance(device, Device)
@@ -507,6 +510,7 @@ class TestTPLinkClient(TestCase):
507
510
  self.assertEqual(device.hostname, 'iPhone2')
508
511
  self.assertEqual(device.up_speed, 800)
509
512
  self.assertEqual(device.down_speed, 400)
513
+ self.assertEqual(device.active, True)
510
514
 
511
515
  device = status.devices[4]
512
516
  self.assertIsInstance(device, Device)
@@ -518,6 +522,7 @@ class TestTPLinkClient(TestCase):
518
522
  self.assertEqual(device.hostname, 'IoT_thing')
519
523
  self.assertEqual(device.up_speed, 1824)
520
524
  self.assertEqual(device.down_speed, 800)
525
+ self.assertEqual(device.active, True)
521
526
 
522
527
  device = status.devices[5]
523
528
  self.assertIsInstance(device, Device)
@@ -529,6 +534,7 @@ class TestTPLinkClient(TestCase):
529
534
  self.assertEqual(device.hostname, 'PC')
530
535
  self.assertEqual(device.up_speed, 600)
531
536
  self.assertEqual(device.down_speed, 50)
537
+ self.assertEqual(device.active, True)
532
538
 
533
539
  def test_get_status_without_iot(self) -> None:
534
540
  client = TplinkC80RouterTest('', '')
@@ -734,7 +734,6 @@ ussdStatus=1
734
734
 
735
735
  class TPLinkMRClientTest(TPLinkMRClient):
736
736
  def _request(self, url, method='POST', data_str=None, encrypt=False):
737
- nonlocal check_url, check_data
738
737
  check_url.append(url)
739
738
  check_data.append(data_str)
740
739
  return 200, responses.pop(0)
@@ -776,7 +775,6 @@ ussdStatus=2
776
775
 
777
776
  class TPLinkMRClientTest(TPLinkMRClient):
778
777
  def _request(self, url, method='POST', data_str=None, encrypt=False):
779
- nonlocal check_url, check_data
780
778
  check_url.append(url)
781
779
  check_data.append(data_str)
782
780
  return 200, responses.pop(0)
@@ -328,6 +328,7 @@ class TplinkC80Router(AbstractRouter):
328
328
  device_to_add = Device(connection_type, EUI48(device['mac']), IPv4Address(device['ip']), device['name'])
329
329
  device_to_add.up_speed = int(device['up'])
330
330
  device_to_add.down_speed = int(device['down'])
331
+ device_to_add.active = device['online'] == '1'
331
332
  mapped_devices.append(device_to_add)
332
333
  return mapped_devices
333
334
 
@@ -1,5 +1,7 @@
1
1
  from base64 import b64decode
2
2
  from json import dumps
3
+ from requests.exceptions import ConnectTimeout
4
+ from collections.abc import Callable
3
5
  from macaddress import EUI48
4
6
  from ipaddress import IPv4Address
5
7
  from logging import Logger
@@ -149,6 +151,22 @@ class TPLinkDecoClient(TplinkEncryption, AbstractRouter):
149
151
 
150
152
  return ipv4_status
151
153
 
154
+ def authorize(self) -> None:
155
+ self._retry_request(super().authorize)
156
+
157
+ def request(self, path: str, data: str, ignore_response: bool = False, ignore_errors: bool = False) -> dict | None:
158
+ return self._retry_request(super().request, path, data, ignore_response, ignore_errors)
159
+
160
+ def _retry_request(self, callback: Callable, *args):
161
+ retries = 0
162
+ while True:
163
+ try:
164
+ return callback(*args)
165
+ except ConnectTimeout as err:
166
+ if retries > 2:
167
+ raise err
168
+ retries += 1
169
+
152
170
  def _map_wire_type(self, data: dict) -> Connection:
153
171
  if data.get('wire_type') == 'wired':
154
172
  return Connection.WIRED
@@ -25,6 +25,7 @@ class Device:
25
25
  self.down_speed: int | None = None
26
26
  self.up_speed: int | None = None
27
27
  self.signal: int | None = None
28
+ self.active: bool = True
28
29
 
29
30
  @property
30
31
  def macaddr(self):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: tplinkrouterc6u
3
- Version: 5.6.1
3
+ Version: 5.7.0
4
4
  Summary: TP-Link Router API (supports also Mercusys Router)
5
5
  Home-page: https://github.com/AlexandrErohin/TP-Link-Archer-C6U
6
6
  Author: Alex Erohin
@@ -25,6 +25,7 @@ Dynamic: classifier
25
25
  Dynamic: description
26
26
  Dynamic: description-content-type
27
27
  Dynamic: home-page
28
+ Dynamic: license-file
28
29
  Dynamic: requires-dist
29
30
  Dynamic: requires-python
30
31
  Dynamic: summary
@@ -186,6 +187,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
186
187
  | down_speed | download speed | int, None |
187
188
  | up_speed | upload speed | int, None |
188
189
  | signal | Signal strength | int, None |
190
+ | active | Is active device | bool |
189
191
 
190
192
  ### <a id="IPv4Reservation">IPv4Reservation</a>
191
193
  | Field | Description | Type |
@@ -288,12 +290,12 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
288
290
  - [MERCUSYS routers](#mercusys)
289
291
  ### <a id="tplink">TP-LINK routers</a>
290
292
  - Archer A7 V5
291
- - Archer A8 1.0
293
+ - Archer A8 (1.0, 2.20)
292
294
  - Archer A9 V6
295
+ - Archer A20 v1.0
293
296
  - Archer AX10 v1.0
294
297
  - Archer AX12 v1.0
295
- - Archer AX20 v1.0
296
- - Archer AX20 v3.0
298
+ - Archer AX20 (v1.0, v3.0)
297
299
  - Archer AX21 (v1.20, v3.0)
298
300
  - Archer AX23 (v1.0, v1.2)
299
301
  - Archer AX50 v1.0
@@ -317,6 +319,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
317
319
  - Archer C6 (v2.0, v3.0, 4.0)
318
320
  - Archer C6U v1.0
319
321
  - Archer C7 (v4.0, v5.0)
322
+ - Archer C24 (1.0, 2.0)
320
323
  - Archer C60 v2.0
321
324
  - Archer C80 (1.0, 2.20)
322
325
  - Archer C5400X V1
@@ -337,6 +340,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
337
340
  - Deco P7
338
341
  - Deco X20
339
342
  - Deco X50 v1.3
343
+ - Deco X55 1.0
340
344
  - Deco X60 V3
341
345
  - Deco X90
342
346
  - Deco XE75 (v1.0, v2.0)
@@ -349,11 +353,13 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
349
353
  - TL-MR105
350
354
  - TL-MR6400 (v5, v5.3)
351
355
  - TL-MR6500v
356
+ - TL-WA1201 3.0
352
357
  - TL-WA3001 v1.0
353
358
  - TL-XDR3010 V2
354
359
  - XC220-G3v v2.30
355
360
  ### <a id="mercusys">MERCUSYS routers</a>
356
361
  - MR47BE v1.0
362
+ - MR50G 1.0
357
363
  - H60XR 1.0
358
364
 
359
365
  Please let me know if you have tested integration with any other model. Open an issue with info about router's model, hardware and firmware versions.
File without changes