python-library-lan-router 0.1.1__tar.gz → 0.1.3__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_library_lan_router-0.1.3/.gitignore +25 -0
- {python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/PKG-INFO +1 -1
- {python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/lan_router/tplink.py +19 -5
- {python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/pyproject.toml +1 -1
- {python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/tests/test_lan_router.py +10 -0
- python_library_lan_router-0.1.1/.gitignore +0 -13
- {python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/lan_router/__init__.py +0 -0
- {python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/lan_router/base.py +0 -0
- {python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/lan_router/device.py +0 -0
- {python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/requirements.txt +0 -0
- {python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/settings.py +0 -0
- {python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/test.bat +0 -0
- {python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/tests/router_scan_demo.py +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.pyc
|
|
3
|
+
*.pyo
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.venv/
|
|
8
|
+
.env
|
|
9
|
+
.env.*
|
|
10
|
+
!.env.example
|
|
11
|
+
# packages 示例本地密钥(*.example 为模板,可提交)
|
|
12
|
+
packages/**/examples/**/.env
|
|
13
|
+
!packages/**/examples/**/.env.example
|
|
14
|
+
packages/**/examples/**/mcp.json
|
|
15
|
+
!packages/**/examples/**/mcp.json.example
|
|
16
|
+
packages/**/examples/**/.sandbox/
|
|
17
|
+
packages/**/examples/**/scratch/*
|
|
18
|
+
!packages/**/examples/**/scratch/.gitkeep
|
|
19
|
+
packages/**/examples/**/_ocr_once*.log
|
|
20
|
+
packages/**/examples/**/_ocr_once*.txt
|
|
21
|
+
.pytest_cache/
|
|
22
|
+
config.yaml
|
|
23
|
+
logs/
|
|
24
|
+
.cursor/
|
|
25
|
+
uv.lock
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
+
from tplinkrouterc6u import TPLinkXDRClient
|
|
2
|
+
|
|
1
3
|
from .base import BaseRouter
|
|
2
4
|
from .device import Device
|
|
3
|
-
from tplinkrouterc6u import TPLinkXDRClient
|
|
4
5
|
|
|
5
|
-
class TPLinkRouter(BaseRouter):
|
|
6
|
-
_router: TPLinkXDRClient = None
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
class _TPLinkXDRClientNoProxy(TPLinkXDRClient):
|
|
8
|
+
"""TP-Link 客户端;忽略 HTTP_PROXY 等环境变量,内网路由器应直连。"""
|
|
9
|
+
|
|
10
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
11
|
+
super().__init__(*args, **kwargs)
|
|
12
|
+
self._session.trust_env = False
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class TPLinkRouter(BaseRouter):
|
|
16
|
+
_router: TPLinkXDRClient | None = None
|
|
17
|
+
|
|
18
|
+
def model_post_init(self, ctx) -> None:
|
|
19
|
+
self._router = _TPLinkXDRClientNoProxy(
|
|
20
|
+
self.hostname,
|
|
21
|
+
self.username,
|
|
22
|
+
self.password,
|
|
23
|
+
)
|
|
10
24
|
|
|
11
25
|
def login(self):
|
|
12
26
|
self._router.authorize()
|
{python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/tests/test_lan_router.py
RENAMED
|
@@ -21,6 +21,16 @@ class LanRouterTests(unittest.TestCase):
|
|
|
21
21
|
self.assertEqual(d.ip, "192.168.0.1")
|
|
22
22
|
self.assertFalse(d.active)
|
|
23
23
|
|
|
24
|
+
def test_tplink_router_ignores_http_proxy_env(self) -> None:
|
|
25
|
+
router = create_router(
|
|
26
|
+
"tplink",
|
|
27
|
+
hostname="192.168.1.1",
|
|
28
|
+
username="admin",
|
|
29
|
+
password="secret",
|
|
30
|
+
)
|
|
31
|
+
assert router._router is not None
|
|
32
|
+
self.assertFalse(router._router._session.trust_env)
|
|
33
|
+
|
|
24
34
|
|
|
25
35
|
if __name__ == "__main__":
|
|
26
36
|
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_library_lan_router-0.1.1 → python_library_lan_router-0.1.3}/tests/router_scan_demo.py
RENAMED
|
File without changes
|