A Python implementation of ADB with shell and FileSync functionality.
Project description
Documentation for this package can be found at https://adb-shell.readthedocs.io/.
This Python package implements ADB shell and FileSync functionality. It originated from python-adb.
Installation
pip install adb-shell
USB Support (Experimental)
To connect to a device via USB, install this package via:
pip install adb-shell[usb]
Async
To utilize the async version of this code, you must install into a Python 3.6+ environment.
Example Usage
(Based on androidtv/adb_manager.py)
from adb_shell.adb_device import AdbDeviceTcp, AdbDeviceUsb
from adb_shell.auth.sign_pythonrsa import PythonRSASigner
# Connect (no authentication necessary)
device1 = AdbDeviceTcp('192.168.0.111', 5555, default_timeout_s=9.)
device1.connect(auth_timeout_s=0.1)
# Connect (authentication required)
with open('path/to/adbkey') as f:
priv = f.read()
signer = PythonRSASigner('', priv)
device2 = AdbDeviceTcp('192.168.0.222', 5555, default_timeout_s=9.)
device2.connect(rsa_keys=[signer], auth_timeout_s=0.1)
# Connect via USB (package must be installed via `pip install adb-shell[usb])`
with open('path/to/adbkey') as f:
priv = f.read()
signer = PythonRSASigner('', priv)
device3 = AdbDeviceUsb('ab78c6ef')
device3.connect(rsa_keys=[signer], auth_timeout_s=0.1)
# Send a shell command
response1 = device1.shell('echo TEST1')
response2 = device2.shell('echo TEST2')
response3 = device3.shell('echo TEST3')
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
adb_shell-0.1.6.tar.gz
(36.1 kB
view hashes)
Built Distribution
adb_shell-0.1.6-py3-none-any.whl
(47.5 kB
view hashes)
Close
Hashes for adb_shell-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c95734f4e1acbf310bbc4efdc4d8547f80b690ca0bfbc7a41116f8614241932 |
|
MD5 | d17184003bc9828b389c6144d7cc20b9 |
|
BLAKE2b-256 | 378a6534972954f1d44a2d2262b904ee36f3c346eedeeae22d8d04684604a6a5 |