uiautodev 0.9.0__tar.gz → 0.10.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.

Potentially problematic release.


This version of uiautodev might be problematic. Click here for more details.

Files changed (40) hide show
  1. {uiautodev-0.9.0 → uiautodev-0.10.0}/PKG-INFO +3 -26
  2. {uiautodev-0.9.0 → uiautodev-0.10.0}/README.md +1 -24
  3. {uiautodev-0.9.0 → uiautodev-0.10.0}/pyproject.toml +2 -2
  4. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/__init__.py +1 -1
  5. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/app.py +2 -1
  6. uiautodev-0.10.0/uiautodev/router/proxy.py +58 -0
  7. {uiautodev-0.9.0 → uiautodev-0.10.0}/LICENSE +0 -0
  8. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/__main__.py +0 -0
  9. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/appium_proxy.py +0 -0
  10. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/binaries/scrcpy_server.jar +0 -0
  11. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/case.py +0 -0
  12. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/cli.py +0 -0
  13. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/command_proxy.py +0 -0
  14. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/command_types.py +0 -0
  15. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/common.py +0 -0
  16. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/driver/android.py +0 -0
  17. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/driver/appium.py +0 -0
  18. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/driver/base_driver.py +0 -0
  19. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/driver/harmony.py +0 -0
  20. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/driver/ios.py +0 -0
  21. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/driver/mock.py +0 -0
  22. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/driver/testdata/layout.json +0 -0
  23. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/driver/udt/appium-uiautomator2-v5.12.4-light.apk +0 -0
  24. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/driver/udt/udt.py +0 -0
  25. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/exceptions.py +0 -0
  26. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/model.py +0 -0
  27. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/provider.py +0 -0
  28. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/remote/android_input.py +0 -0
  29. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/remote/harmony_mjpeg.py +0 -0
  30. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/remote/keycode.py +0 -0
  31. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/remote/scrcpy.py +0 -0
  32. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/remote/touch_controller.py +0 -0
  33. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/router/android.py +0 -0
  34. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/router/device.py +0 -0
  35. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/router/xml.py +0 -0
  36. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/static/demo.html +0 -0
  37. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/utils/common.py +0 -0
  38. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/utils/envutils.py +0 -0
  39. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/utils/exceptions.py +0 -0
  40. {uiautodev-0.9.0 → uiautodev-0.10.0}/uiautodev/utils/usbmux.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: uiautodev
3
- Version: 0.9.0
3
+ Version: 0.10.0
4
4
  Summary: Mobile UI Automation, include UI hierarchy inspector, script recorder
5
5
  License: MIT
6
6
  Author: codeskyblue
@@ -18,7 +18,7 @@ Requires-Dist: Pillow
18
18
  Requires-Dist: adbutils (>=2.8.10,<3)
19
19
  Requires-Dist: click (>=8.1.7,<9.0.0)
20
20
  Requires-Dist: construct
21
- Requires-Dist: fastapi (==0.115.12)
21
+ Requires-Dist: fastapi (>=0.115.12,<1)
22
22
  Requires-Dist: httpx
23
23
  Requires-Dist: lxml
24
24
  Requires-Dist: pydantic (>=2.6,<3.0)
@@ -76,31 +76,8 @@ uiauto.dev
76
76
  ```
77
77
 
78
78
  # DEVELOP
79
- ```bash
80
- # install poetry (python package manager)
81
- pip install poetry # pipx install poetry
82
-
83
- # install deps
84
- poetry install
85
-
86
- # format import
87
- make format
88
-
89
- # run server
90
- make dev
91
-
92
- # If you encounter the error NameError: name 'int2byte' is not defined,
93
- # try installing a stable version of the construct package to resolve it:
94
- # and restart: make dev
95
- pip install construct==2.9.45
96
79
 
97
- ```
98
-
99
- 运行测试
100
-
101
- ```sh
102
- make test
103
- ```
80
+ see [DEVELOP.md](DEVELOP.md)
104
81
 
105
82
  # Links
106
83
  - https://app.tangoapp.dev/ 基于webadb的手机远程控制项目
@@ -42,31 +42,8 @@ uiauto.dev
42
42
  ```
43
43
 
44
44
  # DEVELOP
45
- ```bash
46
- # install poetry (python package manager)
47
- pip install poetry # pipx install poetry
48
-
49
- # install deps
50
- poetry install
51
-
52
- # format import
53
- make format
54
-
55
- # run server
56
- make dev
57
-
58
- # If you encounter the error NameError: name 'int2byte' is not defined,
59
- # try installing a stable version of the construct package to resolve it:
60
- # and restart: make dev
61
- pip install construct==2.9.45
62
45
 
63
- ```
64
-
65
- 运行测试
66
-
67
- ```sh
68
- make test
69
- ```
46
+ see [DEVELOP.md](DEVELOP.md)
70
47
 
71
48
  # Links
72
49
  - https://app.tangoapp.dev/ 基于webadb的手机远程控制项目
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "uiautodev"
3
- version = "0.9.0"
3
+ version = "0.10.0"
4
4
  description = "Mobile UI Automation, include UI hierarchy inspector, script recorder"
5
5
  homepage = "https://uiauto.dev"
6
6
  authors = ["codeskyblue <codeskyblue@gmail.com>"]
@@ -17,7 +17,7 @@ adbutils = ">=2.8.10,<3"
17
17
  click = "^8.1.7"
18
18
  pygments = ">=2"
19
19
  uiautomator2 = ">=3.2.0,<4"
20
- fastapi = "0.115.12"
20
+ fastapi = ">=0.115.12,<1"
21
21
  pydantic = "^2.6"
22
22
  wdapy = ">0.2.2,<1"
23
23
  websockets = ">=10.4"
@@ -5,4 +5,4 @@
5
5
  """
6
6
 
7
7
  # version is auto managed by poetry
8
- __version__ = "0.9.0"
8
+ __version__ = "0.10.0"
@@ -27,6 +27,7 @@ from uiautodev.provider import AndroidProvider, HarmonyProvider, IOSProvider, Mo
27
27
  from uiautodev.remote.scrcpy import ScrcpyServer
28
28
  from uiautodev.router.android import router as android_device_router
29
29
  from uiautodev.router.device import make_router
30
+ from uiautodev.router.proxy import router as proxy_router
30
31
  from uiautodev.router.xml import router as xml_router
31
32
  from uiautodev.utils.envutils import Environment
32
33
 
@@ -70,7 +71,7 @@ else:
70
71
 
71
72
  app.include_router(xml_router, prefix="/api/xml", tags=["xml"])
72
73
  app.include_router(android_device_router, prefix="/api/android", tags=["android"])
73
-
74
+ app.include_router(proxy_router, prefix="/proxy", tags=["proxy"])
74
75
 
75
76
  @app.get('/api/{platform}/features')
76
77
  def get_features(platform: str) -> Dict[str, bool]:
@@ -0,0 +1,58 @@
1
+ import asyncio
2
+
3
+ import httpx
4
+ import websockets
5
+ from fastapi import APIRouter, HTTPException, Request, WebSocket, WebSocketDisconnect
6
+ from fastapi.responses import Response
7
+ import logging
8
+
9
+
10
+ logger = logging.getLogger(__name__)
11
+ router = APIRouter()
12
+
13
+
14
+ # HTTP 转发
15
+ @router.api_route("/http/{target_url:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"])
16
+ async def proxy_http(request: Request, target_url: str):
17
+ logger.info(f"HTTP target_url: {target_url}")
18
+
19
+ async with httpx.AsyncClient(timeout=httpx.Timeout(30.0)) as client:
20
+ body = await request.body()
21
+ resp = await client.request(
22
+ request.method,
23
+ target_url,
24
+ content=body,
25
+ headers={k: v for k, v in request.headers.items() if k.lower() != "host" and k.lower() != "x-target-url"}
26
+ )
27
+ return Response(content=resp.content, status_code=resp.status_code, headers=dict(resp.headers))
28
+
29
+ # WebSocket 转发
30
+ @router.websocket("/ws/{target_url:path}")
31
+ async def proxy_ws(websocket: WebSocket, target_url: str):
32
+ await websocket.accept()
33
+ logger.info(f"WebSocket target_url: {target_url}")
34
+
35
+ try:
36
+ async with websockets.connect(target_url) as target_ws:
37
+ async def from_client():
38
+ while True:
39
+ msg = await websocket.receive_text()
40
+ await target_ws.send(msg)
41
+
42
+ async def from_server():
43
+ while True:
44
+ msg = await target_ws.recv()
45
+ if isinstance(msg, bytes):
46
+ await websocket.send_bytes(msg)
47
+ elif isinstance(msg, str):
48
+ await websocket.send_text(msg)
49
+ else:
50
+ raise RuntimeError("Unknown message type", msg)
51
+
52
+ await asyncio.gather(from_client(), from_server())
53
+
54
+ except WebSocketDisconnect:
55
+ pass
56
+ except Exception as e:
57
+ logger.error(f"WS Error: {e}")
58
+ await websocket.close()
File without changes
File without changes
File without changes
File without changes