ADB Python wrapper library with enhanced functionality
Project description
My ADB Lib
Thư viện Python wrapper cho Android Debug Bridge (ADB) không yêu cầu phụ thuộc bên ngoài.
Giới thiệu
My ADB Lib là một thư viện Python giúp tương tác với thiết bị Android thông qua ADB (Android Debug Bridge). Thư viện này được thiết kế để đơn giản hóa việc sử dụng các lệnh ADB trong các ứng dụng Python, tự động hóa kiểm thử, và quản lý thiết bị Android.
Yêu cầu
- Python 3.6 trở lên
- ADB đã được cài đặt và có trong PATH
Cài đặt
pip install my-adb-lib
Hoặc cài đặt từ mã nguồn:
git clone https://github.com/yourusername/my-adb-lib.git
cd my-adb-lib
pip install -e .
Cách sử dụng
Khởi tạo
from my_adb_lib import MyADB
# Khởi tạo với thiết bị mặc định
adb = MyADB()
# Hoặc chỉ định thiết bị cụ thể
adb = MyADB(device_id="emulator-5554")
Các thao tác cơ bản
# Liệt kê các thiết bị đã kết nối
devices = adb.get_devices()
print(devices)
# Cài đặt ứng dụng
adb.install_app("/path/to/app.apk")
# Gỡ cài đặt ứng dụng
adb.uninstall_app("com.example.app")
# Khởi động lại thiết bị
adb.reboot_device()
Tương tác với thiết bị
from my_adb_lib.commands import interaction
# Nhấn vào tọa độ màn hình
interaction.tap(500, 500)
# Vuốt màn hình
interaction.swipe(100, 500, 600, 500)
# Nhập văn bản
interaction.text_input("Hello World")
# Nhấn phím Home
interaction.home()
Quản lý file
from my_adb_lib.commands import file_ops
# Đẩy file từ máy tính lên thiết bị
file_ops.push("/path/on/computer", "/path/on/device")
# Lấy file từ thiết bị về máy tính
file_ops.pull("/path/on/device", "/path/on/computer")
Xem log
from my_adb_lib.commands import logs
# Xem logcat
logcat_output = logs.logcat()
print(logcat_output)
# Tạo báo cáo lỗi
bugreport = logs.bugreport()
Tài liệu API
Lớp MyADB
Lớp chính để tương tác với ADB.
__init__(device_id=None): Khởi tạo đối tượng ADB với ID thiết bị tùy chọnrun(command): Chạy lệnh ADB tùy chỉnhget_devices(): Liệt kê các thiết bị đã kết nốireboot_device(): Khởi động lại thiết bịinstall_app(apk_path): Cài đặt ứng dụng từ file APKuninstall_app(package_name): Gỡ cài đặt ứng dụngpush_file(local_path, remote_path): Đẩy file lên thiết bịpull_file(remote_path, local_path): Lấy file từ thiết bịget_device_info(): Lấy thông tin thiết bị
Module commands
Các module lệnh chuyên biệt:
app_info: Lấy thông tin ứng dụngapps: Quản lý ứng dụngbasic: Các lệnh ADB cơ bảnconnect: Kết nối thiết bị qua mạngdevice_actions: Các hành động thiết bịdevice_info: Thông tin thiết bịfile_ops: Thao tác fileinteraction: Tương tác với thiết bịlogs: Xem log thiết bịpermissions: Quản lý quyền
Đóng góp
Đóng góp luôn được chào đón! Vui lòng tạo issue hoặc pull request trên GitHub.
Giấy phép
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oiadb-0.2.0.tar.gz.
File metadata
- Download URL: oiadb-0.2.0.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84dbc4d10270a07aafbfd58683f9601294b8e26920ed514c96de470a0cae59a2
|
|
| MD5 |
37fd522d5270cc9e97afde2c23be6dd1
|
|
| BLAKE2b-256 |
7cb959061f52692f2502531a522ad2f1929109b8032667d0dc1f146f5cd5bb9a
|
File details
Details for the file oiadb-0.2.0-py3-none-any.whl.
File metadata
- Download URL: oiadb-0.2.0-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a383257ad23882d01ac92e658b1e3b96737e347cb655e1a317680a6d145110c0
|
|
| MD5 |
415f7a84e18c6eb15d45c1f61efc05ee
|
|
| BLAKE2b-256 |
eca16f392696b88edb8d87934b29da71c393a7db06ce3046ffa8b65e2f6a9675
|