Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit 2c649e4

Browse files
committed
Add PyCon2016 presentation to README
1 parent e8bd324 commit 2c649e4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)