tplinkrouterc6u 5.0.1__py3-none-any.whl → 5.0.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
@@ -70,7 +70,7 @@ class TestTPLinkDecoClient(TestCase):
70
70
  "connection_type": "band5", "space_id": "1", "ip": "192.168.68.104", "client_mesh": true,
71
71
  "online": true, "name": "d2lyZWxlc3M0", "enable_priority": false, "remain_time": 0, "owner_id": "",
72
72
  "client_type": "other", "interface": "guest"},
73
- {"mac": "56:32:c3:de:ce:f0", "up_speed": 3, "down_speed": 1, "wire_type": "wireless", "access_host": "1",
73
+ {"mac": "", "up_speed": 3, "down_speed": 1, "wire_type": "wireless", "access_host": "1",
74
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"}
@@ -149,7 +149,7 @@ class TestTPLinkDecoClient(TestCase):
149
149
  self.assertEqual(status.devices[3].packets_received, None)
150
150
  self.assertIsInstance(status.devices[4], Device)
151
151
  self.assertEqual(status.devices[4].type, Connection.GUEST_2G)
152
- self.assertEqual(status.devices[4].macaddr, '56-32-C3-DE-CE-F0')
152
+ self.assertEqual(status.devices[4].macaddr, '00-00-00-00-00-00')
153
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)
tplinkrouterc6u/client.py CHANGED
@@ -10,7 +10,7 @@ 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
+ from tplinkrouterc6u.helper import get_ip, get_mac
14
14
  from tplinkrouterc6u.encryption import EncryptionWrapper, EncryptionWrapperMR
15
15
  from tplinkrouterc6u.package_enum import Connection
16
16
  from tplinkrouterc6u.dataclass import Firmware, Status, Device, IPv4Reservation, IPv4DHCPLease, IPv4Status
@@ -355,7 +355,7 @@ class TplinkBaseRouter(AbstractRouter, TplinkRequest):
355
355
  devices = {}
356
356
 
357
357
  def _add_device(conn: Connection, item: dict) -> None:
358
- devices[item['macaddr']] = Device(conn, EUI48(item['macaddr']),
358
+ devices[item['macaddr']] = Device(conn, get_mac(item.get('macaddr', '00:00:00:00:00:00')),
359
359
  get_ip(item['ipaddr']),
360
360
  item['hostname'])
361
361
 
@@ -382,8 +382,8 @@ class TplinkBaseRouter(AbstractRouter, TplinkRequest):
382
382
  for item in smart_network:
383
383
  if item['mac'] not in devices:
384
384
  conn = self._map_wire_type(item.get('deviceTag'), not item.get('isGuest'))
385
- devices[item['mac']] = Device(conn, EUI48(item['mac']), get_ip(item['ip']),
386
- item['deviceName'])
385
+ devices[item['mac']] = Device(conn, get_mac(item.get('mac', '00:00:00:00:00:00')),
386
+ get_ip(item['ip']), item['deviceName'])
387
387
  if conn.is_iot():
388
388
  if status.iot_clients_total is None:
389
389
  status.iot_clients_total = 0
@@ -581,7 +581,7 @@ class TPLinkDecoClient(TplinkEncryption, AbstractRouter):
581
581
  status.iot_clients_total += 1
582
582
 
583
583
  device = Device(conn,
584
- EUI48(item['mac']),
584
+ get_mac(item.get('mac', '00:00:00:00:00:00')),
585
585
  get_ip(item.get('ip', '0.0.0.0')),
586
586
  b64decode(item['name']).decode())
587
587
  device.down_speed = item.get('down_speed')
@@ -1440,8 +1440,10 @@ class TplinkRouterProvider:
1440
1440
  router = TplinkC1200Router(host, password, username, logger, verify_ssl, timeout)
1441
1441
  try:
1442
1442
  router.authorize()
1443
+ return router
1443
1444
  except AuthorizeError as e:
1444
- logger.error(e.__str__())
1445
+ if logger:
1446
+ logger.error(e.__str__())
1445
1447
  raise ClientException(('Login failed! Please check if your router local password is correct or '
1446
1448
  'try to use web encrypted password instead. Check the documentation!'
1447
1449
  ))
tplinkrouterc6u/helper.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from ipaddress import IPv4Address
2
+ from macaddress import EUI48
2
3
 
3
4
 
4
5
  def get_ip(ip: str) -> IPv4Address:
@@ -6,3 +7,10 @@ def get_ip(ip: str) -> IPv4Address:
6
7
  return IPv4Address(ip)
7
8
  except Exception:
8
9
  return IPv4Address('0.0.0.0')
10
+
11
+
12
+ def get_mac(mac: str) -> EUI48:
13
+ try:
14
+ return EUI48(mac)
15
+ except Exception:
16
+ return EUI48('00:00:00:00:00:00')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tplinkrouterc6u
3
- Version: 5.0.1
3
+ Version: 5.0.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
@@ -257,8 +257,9 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
257
257
  - Archer GX90 v1.0
258
258
  - Archer MR200 (v5, v5.3)
259
259
  - Archer MR600 (v1, v2, v3)
260
- - Archer VR2100v v1
260
+ - Archer VR600 v3
261
261
  - Archer VR900v
262
+ - Archer VR2100v v1
262
263
  - Deco M4 2.0
263
264
  - Deco M4R 2.0
264
265
  - Deco M5 v3
@@ -289,7 +290,6 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
289
290
  - Archer C900 V1
290
291
  - Archer C1200 V3
291
292
  - Archer C1900 V2
292
- - Archer C2300 V2
293
293
  - Archer C4000 (V2 and V3)
294
294
  - Archer C5400 V2
295
295
  - TL-WR1043N V5
@@ -1,17 +1,17 @@
1
1
  test/__init__.py,sha256=McQmUjeN3AwmwdS6QNfwGXXE77OKoPK852I2BM9XsrU,210
2
2
  test/test_client.py,sha256=8cK4qnheszu-zpUJqttKp5Z5WJXrQy1t_fMzMzNnmvw,30638
3
3
  test/test_client_c1200.py,sha256=O6NK9uXIEb_vks6lI3g7j6q8TYJ9MSDFYzGA_wOBhOA,4620
4
- test/test_client_deco.py,sha256=OqJ9e6_TcX60Ccqj_UH9AQ3Ty25hfdbtPvtzLnWpMn0,30464
4
+ test/test_client_deco.py,sha256=ur4u-pWB-6WaYW6PSpK9OvCg3rfo2x06V5Cf_eE2UYU,30447
5
5
  test/test_client_mr.py,sha256=znDA8PBxHOGKbZHzsyERbEEWjkP0U5KpV8Z-kaRnXIM,23046
6
6
  tplinkrouterc6u/__init__.py,sha256=jHcPujWH-dCjW8s6lCl8TFoTCNM699eMuqQY8CHGmOM,434
7
- tplinkrouterc6u/client.py,sha256=N14ht-C2J0Cuh5o8okBRqp3PB52a24StWA8oWYuYLN8,54957
7
+ tplinkrouterc6u/client.py,sha256=ly9GzUbWyOyDkAX7Cdtb18i3qJtNkRnLmpkT7HKiUvA,55100
8
8
  tplinkrouterc6u/dataclass.py,sha256=SuAOqKun_ThaeUEa8F9wi6qu4ucUatYMzebo39Kk10s,6617
9
9
  tplinkrouterc6u/encryption.py,sha256=4HelTxzN6esMfDZRBt3m8bwB9Nj_biKijnCnrGWPWKg,6228
10
10
  tplinkrouterc6u/exception.py,sha256=_0G8ZvW5__CsGifHrsZeULdl8c6EUD071sDCQsQgrHY,140
11
- tplinkrouterc6u/helper.py,sha256=mbPkS_9GfOYMxEIx-q-xLlupR0-m_MDgCWQgx8xxOA8,172
11
+ tplinkrouterc6u/helper.py,sha256=phcPUdpY7lJVWF8Ih4KHNdsdem2ed6qFSDXuEAtAgug,334
12
12
  tplinkrouterc6u/package_enum.py,sha256=bqmnu4gQMEntMCgsya2R7dRcrSJIDPWMj8vNN6JxeME,1382
13
- tplinkrouterc6u-5.0.1.dist-info/LICENSE,sha256=YF6QR6Vjxcg5b_sYIyqkME7FZYau5TfEUGTG-0JeRK0,35129
14
- tplinkrouterc6u-5.0.1.dist-info/METADATA,sha256=uenPw4SJ7QDFEgCetM5RwgnOJBGpeej5BcObAiZH4Wo,12976
15
- tplinkrouterc6u-5.0.1.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
16
- tplinkrouterc6u-5.0.1.dist-info/top_level.txt,sha256=1iSCCIueqgEkrTxtQ-jiHe99jAB10zqrVdBcwvNfe_M,21
17
- tplinkrouterc6u-5.0.1.dist-info/RECORD,,
13
+ tplinkrouterc6u-5.0.3.dist-info/LICENSE,sha256=YF6QR6Vjxcg5b_sYIyqkME7FZYau5TfEUGTG-0JeRK0,35129
14
+ tplinkrouterc6u-5.0.3.dist-info/METADATA,sha256=myom12xoQvNWDQmYaMdpeN5PPRQUU6vdmrssX0aT9mQ,12976
15
+ tplinkrouterc6u-5.0.3.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
16
+ tplinkrouterc6u-5.0.3.dist-info/top_level.txt,sha256=1iSCCIueqgEkrTxtQ-jiHe99jAB10zqrVdBcwvNfe_M,21
17
+ tplinkrouterc6u-5.0.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5