This repository was archived by the owner on Jan 10, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,27 @@ can be run similar to native `adb` and `fastboot` via the python interpreter:
2525 python adb.zip devices
2626 python adb.zip shell ls /sdcard
2727
28+ ### Using as a Python Library
29+
30+ A [ presentation was made at PyCon 2016] [ pycon_preso ] , and here's some demo code:
31+
32+ ``` python
33+ import os.path as op
34+
35+ from adb import adb_commands
36+ from adb import sign_m2crypto
37+
38+
39+ # KitKat+ devices require authentication
40+ signer = sign_m2crypto.M2CryptoSigner(
41+ op.expanduser(' ~/.android/adbkey' ))
42+ # Connect to the device
43+ device = adb_commands.AdbCommands.ConnectDevice(
44+ rsa_keys = [signer])
45+ # Now we can use Shell, Pull, Push, etc!
46+ for i in xrange (10 ):
47+ print device.Shell(' echo %d ' % i)
48+ ```
2849
2950### Pros
3051
@@ -57,3 +78,4 @@ can be run similar to native `adb` and `fastboot` via the python interpreter:
5778[ coverage_link ] : https://coveralls.io/github/google/python-adb?branch=master
5879[ build_img ] : https://travis-ci.org/google/python-adb.svg?branch=master
5980[ build_link ] : https://travis-ci.org/google/python-adb
81+ [ pycon_preso ] : https://docs.google.com/a/google.com/presentation/d/e/2PACX-1vQ6DsSqOZ3oJBPM72OfxAz7FIxZ0f6tM8ZvAjp15ck9xr5cbtFBgshgOdlIAMmCoO8XmGVOc_c4iWqR/pub?start=false&loop=false&delayms=15000
You can’t perform that action at this time.
0 commit comments