python-library-lan-router 0.1.0__tar.gz → 0.1.1__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.
@@ -8,4 +8,6 @@ build/
8
8
  .env
9
9
  .pytest_cache/
10
10
  config.yaml
11
- logs/
11
+ logs/
12
+ .cursor/
13
+ uv.lock
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-library-lan-router
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Requires-Python: >=3.10
5
5
  Requires-Dist: pydantic>=2.0.0
6
6
  Requires-Dist: tplinkrouterc6u>=0.1.0
@@ -8,4 +8,6 @@ class Device(BaseModel):
8
8
  mac: str
9
9
  """设备MAC地址"""
10
10
  type: str
11
- """设备类型"""
11
+ """设备类型"""
12
+ active: bool = True
13
+ """路由器报告的在线状态;未返回在线字段时视为在线"""
@@ -23,7 +23,13 @@ class TPLinkRouter(BaseRouter):
23
23
  name = data.hostname or ""
24
24
  ip = self._show(data.ipaddr)
25
25
  mac = self._show(data.macaddr)
26
- device = Device(name=name, ip=ip, mac=mac, type=type)
26
+ device = Device(
27
+ name=name,
28
+ ip=ip,
29
+ mac=mac,
30
+ type=type,
31
+ active=data.active,
32
+ )
27
33
  devices.append(device)
28
34
 
29
35
  return devices
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "python-library-lan-router"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  requires-python = ">=3.10"
9
9
  dependencies = [
10
10
  "tplinkrouterc6u>=0.1.0",
@@ -10,9 +10,16 @@ class LanRouterTests(unittest.TestCase):
10
10
  self.assertIn("不支持", str(ctx.exception))
11
11
 
12
12
  def test_device_model(self) -> None:
13
- d = Device(name="n", ip="192.168.0.1", mac="00:00:00:00:00:01", type="wifi")
13
+ d = Device(
14
+ name="n",
15
+ ip="192.168.0.1",
16
+ mac="00:00:00:00:00:01",
17
+ type="wifi",
18
+ active=False,
19
+ )
14
20
  self.assertEqual(d.name, "n")
15
21
  self.assertEqual(d.ip, "192.168.0.1")
22
+ self.assertFalse(d.active)
16
23
 
17
24
 
18
25
  if __name__ == "__main__":